@Test public void collectionBuilderTest() { Collection<Integer> collection = CollectionBuilder.<Integer>create().add(1).add(2).build(); Assert.assertEquals(collection.size(), 2); Collection<Integer> arrayList = CollectionBuilder.<Integer>create(ReflectUtils.convert(ArrayList.class)).add(1).add(2).build(); Assert.assertEquals(arrayList instanceof List, true); }
private CollectionBuilder() { }
CollectionBuilder { private CollectionBuilder() { } }
CollectionBuilder { private CollectionBuilder() { } private  CollectionBuilder(); }
CollectionBuilder { private CollectionBuilder() { } private  CollectionBuilder(); static CollectionBuilder<E> create(); static CollectionBuilder<E> create(Class<? extends Collection<E>> cls, Object... params); CollectionBuilder<E> add(E element); Collection<E> build(); }
CollectionBuilder { private CollectionBuilder() { } private  CollectionBuilder(); static CollectionBuilder<E> create(); static CollectionBuilder<E> create(Class<? extends Collection<E>> cls, Object... params); CollectionBuilder<E> add(E element); Collection<E> build();  }