@Test public void testImplodeCollectionStingifierOptionalObjects() { List<Integer> testInput = Arrays.asList(1, 2, 3, 4, 5); List<Integer> nullTestInput = null; String seperator = ","; String nullSeperator = null; String actualResult = null; String expectedResult_01 = "1,2,3,4,5"; String expectedResult_02 = ""; String expectedResult_03 = "1null2null3null4null5"; @SuppressWarnings("unchecked") Stringifier<Integer> callback = mock(Stringifier.class); when(callback.execute(testInput.get(0), "")).thenReturn("1"); when(callback.execute(testInput.get(1), "")).thenReturn("2"); when(callback.execute(testInput.get(2), "")).thenReturn("3"); when(callback.execute(testInput.get(3), "")).thenReturn("4"); when(callback.execute(testInput.get(4), "")).thenReturn("5"); actualResult = CollectionUtil.implode(testInput, seperator, callback, ""); assertNotNull(actualResult); assertThat(actualResult, is(expectedResult_01)); assertEquals(expectedResult_01, actualResult); actualResult = CollectionUtil.implode(nullTestInput, seperator, callback, ""); assertNotNull(actualResult); assertThat(actualResult, is(expectedResult_02)); assertEquals(expectedResult_02, actualResult); actualResult = CollectionUtil.implode(testInput, nullSeperator, callback, ""); assertNotNull(actualResult); assertThat(actualResult, is(expectedResult_03)); assertEquals(expectedResult_03, actualResult); }
public static <T> String implode(Collection<T> collection) { return implode(collection, ",", new Stringifier<T>() { public String execute(T obj, Object... args) { return obj.toString(); } }); }
CollectionUtil { public static <T> String implode(Collection<T> collection) { return implode(collection, ",", new Stringifier<T>() { public String execute(T obj, Object... args) { return obj.toString(); } }); } }
CollectionUtil { public static <T> String implode(Collection<T> collection) { return implode(collection, ",", new Stringifier<T>() { public String execute(T obj, Object... args) { return obj.toString(); } }); }  }
CollectionUtil { public static <T> String implode(Collection<T> collection) { return implode(collection, ",", new Stringifier<T>() { public String execute(T obj, Object... args) { return obj.toString(); } }); }  static boolean isEmpty(Collection<?> collection); static boolean hasElements(Collection<?> collection); static List<String> stringify(Collection<T> collection); static List<String> stringify(Collection<T> collection, Stringifier<T> stringifier,
			Object... options); static String implode(Collection<T> collection); static String implode(Collection<T> collection, String separator); static String implode(Collection<T> collection, Stringifier<T> stringifier,
			Object... options); static String implode(Collection<T> collection, String sep,
			Stringifier<T> stringifier, Object... options); }
CollectionUtil { public static <T> String implode(Collection<T> collection) { return implode(collection, ",", new Stringifier<T>() { public String execute(T obj, Object... args) { return obj.toString(); } }); }  static boolean isEmpty(Collection<?> collection); static boolean hasElements(Collection<?> collection); static List<String> stringify(Collection<T> collection); static List<String> stringify(Collection<T> collection, Stringifier<T> stringifier,
			Object... options); static String implode(Collection<T> collection); static String implode(Collection<T> collection, String separator); static String implode(Collection<T> collection, Stringifier<T> stringifier,
			Object... options); static String implode(Collection<T> collection, String sep,
			Stringifier<T> stringifier, Object... options);  }