StringUtil { public static Set<String> stripPrefix(String prefix, Set<String> values) { Stream<String> stream = values.stream(); return stream.map( t -> { if (t.startsWith(prefix)) { return t.substring(prefix.length()); } return t; } ).collect( Collectors.toSet() ); } private  StringUtil(); static boolean isEmpty(final String value); static String removeQuotes(String s); static String replace(String pattern, String... tplArgs); static Set<String> stripPrefix(String prefix, Set<String> values); static String toLowerCase(String value); static String toUpperCase(String value);  }
@Test public void testStripPrefix() { Set<String> testSet = new HashSet<>( Arrays.asList( "prefixTest1", "prefixTest2", "prefixTest3", "Test4")); testSet = StringUtil.stripPrefix("prefix", testSet); Assert.assertEquals( "Transformed string collection size", 4, testSet.size()); Assert.assertThat( testSet, Matchers.hasItems("Test1", "Test2", "Test3", "Test4")); }