Methods Summary |
---|
public static void | addArray(java.util.Collection c, T[] array)Add all items in an array to a set.
for( int i = 0; i < array.length; ++i )
{
c.add( array[ i ] );
}
|
public static T | getSingleton(java.util.Collection s)
if ( s.size() != 1 )
{
throw new IllegalArgumentException();
}
return( s.iterator().next() );
|
public static boolean | isAllStrings(java.util.Collection c)
return IteratorUtil.getUniformClass( c.iterator() ) == String.class;
|
public static T[] | toArray(java.util.Collection c, java.lang.Class elementClass)
final T[] items = ArrayUtil.newArray( elementClass, c.size() );
c.toArray( items );
return items;
|
public static java.lang.String | toString(java.util.Collection c, java.lang.String delim)
final String[] strings = toStringArray( c );
Arrays.sort( strings );
return StringUtil.toString( delim, (Object[])strings );
|
public static java.lang.String | toString(java.util.Collection c)
return toString( c, ", " );
|
public static java.lang.String[] | toStringArray(java.util.Collection c)
final String[] strings = new String[ c.size() ];
int i = 0;
for( final Object o : c )
{
strings[ i ] = SmartStringifier.toString( o );
++i;
}
return( strings );
|