@SuppressWarnings({"unchecked","rawtypes"}) static <E>AutoSortedCollection<E> createAutoSortedCollection(Supplier<List<SortedListElement<E>>> listSup,Collection<? extends E> values,Comparator<E> comparator){
  List list=listSup.get();
  if (!list.isEmpty()) {
    throw new IllegalArgumentException("List must be empty.");
  }
  Validate.notNull(comparator,"Comparator can't be null.");
  AutoSortedCollection<E> sortedCollection=new AutoListSortedCollection<>(list,comparator);
  sortedCollection.addAll(values);
  return sortedCollection;
}

@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) static < E > AutoSortedCollection < E > createAutoSortedCollection ( Supplier < List < SortedListElement < E > > > listSup , Collection < ? extends E > values , Comparator < E > comparator ) { List list = listSup . get ( ) ; if ( ! list . isEmpty ( ) ) { throw new IllegalArgumentException ( "List must be empty." ) ; } Validate . notNull ( comparator , "Comparator can't be null." ) ; AutoSortedCollection < E > sortedCollection = new AutoListSortedCollection < > ( list , comparator ) ; sortedCollection . addAll ( values ) ; return sortedCollection ; }
construct new auto sorted collection .
