ArrayUtils { public static String[] removeAll( String[] array, String token ) { ArrayList<String> vec = new ArrayList<String>(); for ( String part : array ) { if ( !part.equals( token ) ) { vec.add( part ); } } return vec.toArray( new String[] {} ); }  static String[] removeAll( String[] array, String token ); static String join( String delimiter, String... strings ); static String join( String delimiter, Object... objects ); static String join( String delimiter, Collection<?> objects ); static String join( String delimiter, int[] values ); static String join( String delimiter, double[] values ); static boolean contains( String[] target, String value, boolean caseSensitive, boolean exact ); static boolean contains( String[] target, String value ); static String[] toArray( String s, String delimiter, boolean deleteDoubles ); static List<String> toList( String s, String delimiter, boolean deleteDoubles ); static String[] deleteDoubles( String[] s ); static ArrayList<Integer> splitAsIntList( String str, String delim ); static double[] splitAsDoubles( String str, String delim ); static float[] splitAsFloats( String str, String delim ); static void sortByLengthDescending( String[] strings );  }
@Test public void testRemoveAll() { String[] arr1 = new String[] { "foo", "bar", "baz", "baz", "bazfoo" }; arrayCompare( removeAll( arr1, "bar" ), "foo", "baz", "baz", "bazfoo" ); arrayCompare( removeAll( arr1, "baz" ), "foo", "bar", "bazfoo" ); arrayCompare( removeAll( arr1, "bazba" ), "foo", "bar", "baz", "baz", "bazfoo" ); }