Search in sources :

Example 16 with Splitter

use of com.google.common.base.Splitter in project closure-compiler by google.

the class RefasterJs method getExterns.

private List<String> getExterns() throws IOException {
    Set<String> patterns = new HashSet<>();
    // The args4j library can't handle multiple files provided within the same flag option,
    // like --externs=file1.js,file2.js so handle that here.
    Splitter commaSplitter = Splitter.on(',');
    for (String extern : externs) {
        patterns.addAll(commaSplitter.splitToList(extern));
    }
    return CommandLineRunner.findJsFiles(patterns);
}
Also used : Splitter(com.google.common.base.Splitter) HashSet(java.util.HashSet)

Example 17 with Splitter

use of com.google.common.base.Splitter in project runelite by runelite.

the class GroundItemsPlugin method reset.

private void reset() {
    Splitter COMMA_SPLITTER = Splitter.on(Pattern.compile("\\s*,\\s*"));
    // gets the hidden items from the text box in the config
    hiddenItemList = COMMA_SPLITTER.splitToList(config.getHiddenItems().trim());
    // gets the highlighted items from the text box in the config
    highlightedItemsList = COMMA_SPLITTER.splitToList(config.getHighlightItems().trim());
    highlightedItems = CacheBuilder.newBuilder().maximumSize(512L).expireAfterAccess(10, TimeUnit.MINUTES).build(new WildcardMatchLoader(highlightedItemsList));
    hiddenItems = CacheBuilder.newBuilder().maximumSize(512L).expireAfterAccess(10, TimeUnit.MINUTES).build(new WildcardMatchLoader(hiddenItemList));
    dirty = true;
}
Also used : Splitter(com.google.common.base.Splitter)

Example 18 with Splitter

use of com.google.common.base.Splitter in project vespa by vespa-engine.

the class CompoundNameTestCase method testAsList.

@Test
public final void testAsList() {
    List<String> l = cn.asList();
    Splitter peoplesFront = Splitter.on('.');
    Iterable<String> answer = peoplesFront.split(NAME);
    Iterator<String> expected = answer.iterator();
    for (int i = 0; i < l.size(); ++i) {
        assertEquals(expected.next(), l.get(i));
    }
    assertFalse(expected.hasNext());
}
Also used : Splitter(com.google.common.base.Splitter) Test(org.junit.Test)

Example 19 with Splitter

use of com.google.common.base.Splitter in project vespa by vespa-engine.

the class CompoundNameTestCase method testSize.

@Test
public final void testSize() {
    Splitter s = Splitter.on('.');
    Iterable<String> i = s.split(NAME);
    int n = 0;
    for (@SuppressWarnings("unused") String x : i) {
        ++n;
    }
    assertEquals(n, cn.size());
}
Also used : Splitter(com.google.common.base.Splitter) Test(org.junit.Test)

Example 20 with Splitter

use of com.google.common.base.Splitter in project vespa by vespa-engine.

the class TemplatingTestCase method testGetCurrentResultURL.

@Test
public final void testGetCurrentResultURL() {
    String previous = result.getTemplating().getCurrentResultURL();
    Set<String> expectedParameters = new HashSet<>(Arrays.asList(new String[] { "hits=5", "query=a", "presentation.format=nalle", "offset=1" }));
    Set<String> actualParameters = new HashSet<>();
    Splitter s = Splitter.on("&");
    for (String parameter : s.split(previous.substring(previous.indexOf('?') + 1))) {
        actualParameters.add(parameter);
    }
    assertEquals(expectedParameters, actualParameters);
}
Also used : Splitter(com.google.common.base.Splitter) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

Splitter (com.google.common.base.Splitter)86 ArrayList (java.util.ArrayList)19 IOException (java.io.IOException)11 HashSet (java.util.HashSet)10 File (java.io.File)7 HashMap (java.util.HashMap)7 Test (org.junit.Test)5 BufferedReader (java.io.BufferedReader)4 NonNull (com.android.annotations.NonNull)3 URI (java.net.URI)3 URL (java.net.URL)3 ItemStack (net.minecraft.item.ItemStack)3 StringColumn (tech.tablesaw.api.StringColumn)3 CharMatcher (com.google.common.base.CharMatcher)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 CharSource (com.google.common.io.CharSource)2 BufferedOutputStream (java.io.BufferedOutputStream)2 FileInputStream (java.io.FileInputStream)2 InputStreamReader (java.io.InputStreamReader)2