@Test public void enumerationTest() { Set<String> set = set( "apple", "grape", "pears" ); Set<String> set2 = set( enumeration( set ) ); assertEquals( set, set2 ); }
public static <V> Enumeration<V> enumeration( final Set<V> set ) { final Iterator<V> iter = set.iterator(); return new Enumeration<V>() { @Override public boolean hasMoreElements() { return iter.hasNext(); } @Override public V nextElement() { return iter.next(); } }; }
Sets { public static <V> Enumeration<V> enumeration( final Set<V> set ) { final Iterator<V> iter = set.iterator(); return new Enumeration<V>() { @Override public boolean hasMoreElements() { return iter.hasNext(); } @Override public V nextElement() { return iter.next(); } }; } }
Sets { public static <V> Enumeration<V> enumeration( final Set<V> set ) { final Iterator<V> iter = set.iterator(); return new Enumeration<V>() { @Override public boolean hasMoreElements() { return iter.hasNext(); } @Override public V nextElement() { return iter.next(); } }; }  }
Sets { public static <V> Enumeration<V> enumeration( final Set<V> set ) { final Iterator<V> iter = set.iterator(); return new Enumeration<V>() { @Override public boolean hasMoreElements() { return iter.hasNext(); } @Override public V nextElement() { return iter.next(); } }; }  static Set<V> set( Collection<V> collection ); static Enumeration<V> enumeration( final Set<V> set ); static Set<V> set( Class<V> clazz ); static Set<V> set( Iterable<V> iterable ); static Set<V> set( Enumeration<V> enumeration ); static Set<V> set( Iterator<V> iterator ); @SafeVarargs static Set<V> set( final V... array ); @SafeVarargs static Set<V> set( int size, final V... array  ); static NavigableSet<V> sortedSet( Iterator<V> iterator ); static NavigableSet<V> sortedSet( Class<V> clazz ); static NavigableSet<V> sortedSet( Iterable<V> iterable ); static NavigableSet<V> sortedSet( Enumeration<V> enumeration ); @SafeVarargs static NavigableSet<V> sortedSet( final V... array ); static NavigableSet<V> sortedSet( Collection<V> collection ); static NavigableSet<V> safeSortedSet( Iterator<V> iterator ); static NavigableSet<V> safeSortedSet( Class<V> clazz ); static NavigableSet<V> safeSortedSet( Iterable<V> iterable ); static NavigableSet<V> safeSortedSet( Enumeration<V> enumeration ); @SafeVarargs static NavigableSet<V> safeSortedSet( final V... array ); static NavigableSet<V> safeSortedSet( Collection<V> collection ); static Set<V> safeSet( Class<V> clazz ); static Set<V> safeSet( Iterable<V> iterable ); static Set<V> safeSet( Enumeration<V> enumeration ); static Set<V> safeSet( Iterator<V> iterator ); @SafeVarargs static Set<V> safeSet( final V... array ); static Set<V> safeSet( Collection<V> collection ); @Universal static int len( Set<?> set ); @Universal static boolean in( V value, Set<?> set ); @Universal static void add( Set<V> set, V value ); @Universal static T idx( NavigableSet<T> set, final T index ); @Universal static T idx( Set<T> set, final T index ); static T after( NavigableSet<T> set, final T index ); static T before( NavigableSet<T> set, final T index ); @Universal static SortedSet<V> slc( NavigableSet<V> set, V startIndex, V endIndex ); @Universal static SortedSet<V> slcEnd( NavigableSet<V> set, V fromIndex ); @Universal static SortedSet<V> slc( NavigableSet<V> set, V toIndex ); @Universal static Set<V> copy( HashSet<V> collection ); @Universal static NavigableSet<V> copy( TreeSet<V> collection ); @Universal static Set<V> copy( CopyOnWriteArraySet<V> collection ); @Universal static NavigableSet<V> copy( ConcurrentSkipListSet<V> collection ); @Universal static NavigableSet<V> copy( NavigableSet<V> collection ); @Universal static Set<V> copy( Set<V> collection ); static Set<V> deepCopy( Collection<V> collection ); static Set<V> deepCopyToSet( Collection<V> src,  Set<V> dst); static List<T> deepCopy( Collection<V> src, Class<T> dest  ); @Universal static Set<V> deepCopy( Set<V> set ); static List<Map<String, Object>> toListOfMaps( Set<?> set ); static Set<T> setFromProperty( Class<T> propertyType, String propertyPath, Collection<?> list ); static Set<T> setFromProperty( Class<T> propertyType, String propertyPath, Iterable<?> list ); static String toPrettyJson(Set set); }
Sets { public static <V> Enumeration<V> enumeration( final Set<V> set ) { final Iterator<V> iter = set.iterator(); return new Enumeration<V>() { @Override public boolean hasMoreElements() { return iter.hasNext(); } @Override public V nextElement() { return iter.next(); } }; }  static Set<V> set( Collection<V> collection ); static Enumeration<V> enumeration( final Set<V> set ); static Set<V> set( Class<V> clazz ); static Set<V> set( Iterable<V> iterable ); static Set<V> set( Enumeration<V> enumeration ); static Set<V> set( Iterator<V> iterator ); @SafeVarargs static Set<V> set( final V... array ); @SafeVarargs static Set<V> set( int size, final V... array  ); static NavigableSet<V> sortedSet( Iterator<V> iterator ); static NavigableSet<V> sortedSet( Class<V> clazz ); static NavigableSet<V> sortedSet( Iterable<V> iterable ); static NavigableSet<V> sortedSet( Enumeration<V> enumeration ); @SafeVarargs static NavigableSet<V> sortedSet( final V... array ); static NavigableSet<V> sortedSet( Collection<V> collection ); static NavigableSet<V> safeSortedSet( Iterator<V> iterator ); static NavigableSet<V> safeSortedSet( Class<V> clazz ); static NavigableSet<V> safeSortedSet( Iterable<V> iterable ); static NavigableSet<V> safeSortedSet( Enumeration<V> enumeration ); @SafeVarargs static NavigableSet<V> safeSortedSet( final V... array ); static NavigableSet<V> safeSortedSet( Collection<V> collection ); static Set<V> safeSet( Class<V> clazz ); static Set<V> safeSet( Iterable<V> iterable ); static Set<V> safeSet( Enumeration<V> enumeration ); static Set<V> safeSet( Iterator<V> iterator ); @SafeVarargs static Set<V> safeSet( final V... array ); static Set<V> safeSet( Collection<V> collection ); @Universal static int len( Set<?> set ); @Universal static boolean in( V value, Set<?> set ); @Universal static void add( Set<V> set, V value ); @Universal static T idx( NavigableSet<T> set, final T index ); @Universal static T idx( Set<T> set, final T index ); static T after( NavigableSet<T> set, final T index ); static T before( NavigableSet<T> set, final T index ); @Universal static SortedSet<V> slc( NavigableSet<V> set, V startIndex, V endIndex ); @Universal static SortedSet<V> slcEnd( NavigableSet<V> set, V fromIndex ); @Universal static SortedSet<V> slc( NavigableSet<V> set, V toIndex ); @Universal static Set<V> copy( HashSet<V> collection ); @Universal static NavigableSet<V> copy( TreeSet<V> collection ); @Universal static Set<V> copy( CopyOnWriteArraySet<V> collection ); @Universal static NavigableSet<V> copy( ConcurrentSkipListSet<V> collection ); @Universal static NavigableSet<V> copy( NavigableSet<V> collection ); @Universal static Set<V> copy( Set<V> collection ); static Set<V> deepCopy( Collection<V> collection ); static Set<V> deepCopyToSet( Collection<V> src,  Set<V> dst); static List<T> deepCopy( Collection<V> src, Class<T> dest  ); @Universal static Set<V> deepCopy( Set<V> set ); static List<Map<String, Object>> toListOfMaps( Set<?> set ); static Set<T> setFromProperty( Class<T> propertyType, String propertyPath, Collection<?> list ); static Set<T> setFromProperty( Class<T> propertyType, String propertyPath, Iterable<?> list ); static String toPrettyJson(Set set);  }