How to createan empty list that is associated with the specified comparator (java)? -


my question mysortedlinkedlist constructor...i know head=null; empty list, don't know how include comparator.

you need assign field:

public class mysortedlinkedlist<t> implements iterable<t> {     private mylistnode<t> head;     private final comparator<t> comparator;      public mysortedlinkedlist(comparator<t> comparator) {         head = null;         this.comparator = comparator;     } } 

you can't without introducing field - it's part of differentiates 1 instance another.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -