MCPcopy Create free account
hub / github.com/antlr/codebuff / split

Method split

output/java_guava/1.4.19/Splitter.java:499–512  ·  view source on GitHub ↗

Splits sequence into substrings, splits each substring into an entry, and returns an unmodifiable map with each of the entries. For example, Splitter.on(';').trimResults().withKeyValueSeparator("=>").split("a=>b ; c=>b") will return a mapping from "a" to "b" and {@cod

(CharSequence sequence)

Source from the content-addressed store, hash-verified

497
498
499 public Map<String, String> split(CharSequence sequence) {
500 Map<String, String> map = new LinkedHashMap<String, String>();
501 for (String entry : outerSplitter.split(sequence)) {
502 Iterator<String> entryFields = entrySplitter.splittingIterator(entry);
503 checkArgument(entryFields.hasNext(), INVALID_ENTRY_MESSAGE, entry);
504 String key = entryFields.next();
505 checkArgument(!map.containsKey(key), "Duplicate key [%s] found.", key);
506 checkArgument(entryFields.hasNext(), INVALID_ENTRY_MESSAGE, entry);
507 String value = entryFields.next();
508 map.put(key, value);
509 checkArgument(!entryFields.hasNext(), INVALID_ENTRY_MESSAGE, entry);
510 }
511 return Collections.unmodifiableMap(map);
512 }
513 }
514
515 private interface Strategy {

Callers

nothing calls this directly

Calls 8

nextMethod · 0.65
containsKeyMethod · 0.65
putMethod · 0.65
splitMethod · 0.45
splittingIteratorMethod · 0.45
checkArgumentMethod · 0.45
hasNextMethod · 0.45
unmodifiableMapMethod · 0.45

Tested by

no test coverage detected