@Test(groups = "fast") public void testAsList() { List<Object> list = CollectionUtil.asList(new String[]{"foo", "bar"}); Assert.assertEquals(list.get(0), "foo"); Assert.assertEquals(list.get(1), "bar"); list = CollectionUtil.asList(new String[]{}); Assert.assertEquals(list.size(), 0); list = CollectionUtil.asList(new int[]{0, 1, 2, 3}); Assert.assertEquals(list.get(0), new Integer(0)); Assert.assertEquals(list.get(1), new Integer(1)); Assert.assertEquals(list.get(2), new Integer(2)); Assert.assertEquals(list.get(3), new Integer(3)); }
public static List<Object> asList(Object in) { if (in == null || !in.getClass().isArray()) { throw new IllegalArgumentException("Parameter to asObjectArray must be a non-null array."); } else { int length = Array.getLength(in); LinkedList<Object> list = new LinkedList<Object>(); for (int i = 0; i < length; ++i) { list.add(i, Array.get(in, i)); } return list; } }
CollectionUtil { public static List<Object> asList(Object in) { if (in == null || !in.getClass().isArray()) { throw new IllegalArgumentException("Parameter to asObjectArray must be a non-null array."); } else { int length = Array.getLength(in); LinkedList<Object> list = new LinkedList<Object>(); for (int i = 0; i < length; ++i) { list.add(i, Array.get(in, i)); } return list; } } }
CollectionUtil { public static List<Object> asList(Object in) { if (in == null || !in.getClass().isArray()) { throw new IllegalArgumentException("Parameter to asObjectArray must be a non-null array."); } else { int length = Array.getLength(in); LinkedList<Object> list = new LinkedList<Object>(); for (int i = 0; i < length; ++i) { list.add(i, Array.get(in, i)); } return list; } }  }
CollectionUtil { public static List<Object> asList(Object in) { if (in == null || !in.getClass().isArray()) { throw new IllegalArgumentException("Parameter to asObjectArray must be a non-null array."); } else { int length = Array.getLength(in); LinkedList<Object> list = new LinkedList<Object>(); for (int i = 0; i < length; ++i) { list.add(i, Array.get(in, i)); } return list; } }  static boolean contains(Object[] arr, Object item); static boolean empty(String[] arr); static boolean applies(String events[], String event); static Object[] asObjectArray(Object in); static List<Object> asList(Object in); static List<T> asList(Iterable<T> in); }
CollectionUtil { public static List<Object> asList(Object in) { if (in == null || !in.getClass().isArray()) { throw new IllegalArgumentException("Parameter to asObjectArray must be a non-null array."); } else { int length = Array.getLength(in); LinkedList<Object> list = new LinkedList<Object>(); for (int i = 0; i < length; ++i) { list.add(i, Array.get(in, i)); } return list; } }  static boolean contains(Object[] arr, Object item); static boolean empty(String[] arr); static boolean applies(String events[], String event); static Object[] asObjectArray(Object in); static List<Object> asList(Object in); static List<T> asList(Iterable<T> in);  }