@Test public void splitValues() { final String values = "abc, def,123,77, 99, ysd"; List<String> splittedValues = Header.splitValuesByComma(values); assertEquals(6, splittedValues.size()); assertEquals("abc", splittedValues.get(0)); assertEquals("def", splittedValues.get(1)); assertEquals("123", splittedValues.get(2)); assertEquals("77", splittedValues.get(3)); assertEquals("99", splittedValues.get(4)); assertEquals("ysd", splittedValues.get(5)); }
public static List<String> splitValuesByComma(final String headerValue) { final List<String> singleValues = new ArrayList<>(); String[] parts = headerValue.split(","); for (final String value : parts) { singleValues.add(value.trim()); } return singleValues; }
Header implements Iterable<HeaderField>, Cloneable { public static List<String> splitValuesByComma(final String headerValue) { final List<String> singleValues = new ArrayList<>(); String[] parts = headerValue.split(","); for (final String value : parts) { singleValues.add(value.trim()); } return singleValues; } }
Header implements Iterable<HeaderField>, Cloneable { public static List<String> splitValuesByComma(final String headerValue) { final List<String> singleValues = new ArrayList<>(); String[] parts = headerValue.split(","); for (final String value : parts) { singleValues.add(value.trim()); } return singleValues; } Header(final int lineNumer); }
Header implements Iterable<HeaderField>, Cloneable { public static List<String> splitValuesByComma(final String headerValue) { final List<String> singleValues = new ArrayList<>(); String[] parts = headerValue.split(","); for (final String value : parts) { singleValues.add(value.trim()); } return singleValues; } Header(final int lineNumer); void addHeader(final String name, final String value, final int lineNumber); void addHeader(final String name, final List<String> values, final int lineNumber); void replaceHeaderField(final HeaderField headerField); boolean exists(final String name); void removeHeader(final String name); String getHeader(final String name); List<String> getHeaders(final String name); HeaderField getHeaderField(final String name); int getLineNumber(); Map<String, String> toSingleMap(); Map<String, List<String>> toMultiMap(); @Override Header clone(); @Override Iterator<HeaderField> iterator(); static List<String> splitValuesByComma(final String headerValue); }
Header implements Iterable<HeaderField>, Cloneable { public static List<String> splitValuesByComma(final String headerValue) { final List<String> singleValues = new ArrayList<>(); String[] parts = headerValue.split(","); for (final String value : parts) { singleValues.add(value.trim()); } return singleValues; } Header(final int lineNumer); void addHeader(final String name, final String value, final int lineNumber); void addHeader(final String name, final List<String> values, final int lineNumber); void replaceHeaderField(final HeaderField headerField); boolean exists(final String name); void removeHeader(final String name); String getHeader(final String name); List<String> getHeaders(final String name); HeaderField getHeaderField(final String name); int getLineNumber(); Map<String, String> toSingleMap(); Map<String, List<String>> toMultiMap(); @Override Header clone(); @Override Iterator<HeaderField> iterator(); static List<String> splitValuesByComma(final String headerValue);  }