Your preferences have been saved!
» Add array to collection - import java.util.Arrays; import java.util.Collection; public class Util{   public static <T> void addArrayToCollection(T[] array, Collection<T> collection)   {     collection.addAll(Arrays.asList(array));   } }... 17 Feb 12 » Acts like an java.util.ArrayList but for primitive long values - public class LongList {   private long[] theValue;   private int theSize;   /**    * Creates a list with a capacity of 5    */   public LongList() {     this(5);   }   /**... 17 Feb 12 » Acts like an java.util.ArrayList but for primitive int values - public class IntList {   private int[] theValue;   private int theSize;   /**    * Creates a list with a capacity of 5    */   public IntList() {     this(5);   }   /**... 17 Feb 12 » Growable array of floats. - /** Growable array of floats. */ public class FloatList {   private static final int DEFAULT_SIZE = 10;   private float[] data = new float[DEFAULT_SIZE];   private int numElements;   public void add(float f) {     if (numElements == data.length) {       resize(1 + numElements);     }     data[numElements++] = f;... 17 Feb 12 » Growable array of ints - /** Growable array of ints. */ public class IntList {   private static final int DEFAULT_SIZE = 10;   private int[] data = new int[DEFAULT_SIZE];   private int numElements;   public void add(int f) {     if (numElements == data.length) {       resize(1 + numElements);     }     data[numElements++] = f;... 17 Feb 12 » Converts array into a java.util.Map. - import java.util.HashMap; import java.util.Map; public class Main {   // To map   //-----------------------------------------------------------------------   /**    * <p>Converts the given array into a {@link java.util.Map}. Each element of the array    * must be either a {@link java.util.Map.Entry} or an Array, containing at least two    * elements, where the first element is used as key and the second as    * value.</p>... 17 Feb 12 » Custom ArraySet implementation (extends AbstractSet) - import java.io.Serializable; import java.util.AbstractSet; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.Set; public class ArraySet extends AbstractSet implements Cloneable, Serializable {   private ArrayList list;   public ArraySet() {... 17 Feb 12 » Custom ArrayMap implementation (extends AbstractMap) - import java.io.Serializable; import java.util.AbstractMap; import java.util.AbstractSet; import java.util.ArrayList; import java.util.Iterator; import java.util.Map; import java.util.Set; public class ArrayMap extends AbstractMap implements Cloneable, Serializable {   static class Entry implements Map.Entry {     protected Object key, value;... 17 Feb 12 » ArrayEnumeration class (implements Enumeration) - import java.lang.reflect.Array; import java.util.Enumeration; public class ArrayEnumeration implements Enumeration {   private final int size;   private int cursor;   private final Object array;   public ArrayEnumeration(Object obj) {     Class type = obj.getClass();     if (!type.isArray()) {       throw new IllegalArgumentException("Invalid type: " + type);... 17 Feb 12 » Converting a Collection of String to an Array - import java.util.ArrayList; import java.util.Collection; public class PlanetSet {   public static void main(String args[]) {     String names[] = { "Mercury", "Venus", "Earth", "Mars", "Jupiter",         "Saturn", "Uranus", "Neptune", "Pluto" };     Collection planets = new ArrayList();     for (int i = 0, n = names.length; i < n; i++) {       planets.add(names[i]);     }... 17 Feb 12