Tabnine Logo
Pattern.splitAsStream
Code IndexAdd Tabnine to your IDE (free)

How to use
splitAsStream
method
in
java.util.regex.Pattern

Best Java code snippets using java.util.regex.Pattern.splitAsStream (Showing top 20 results out of 567)

origin: speedment/speedment

/**
 * Creates and returns a Stream of the words in the given text. Words are a
 * group of characters separated by one or more white spaces.
 *
 * @param text containing zero or more words
 * @return a Stream of the words in the given text
 */
public static Stream<String> wordsOf(String text) {
  requireNonNull(text);
  return WORDS.splitAsStream(text);
}
origin: speedment/speedment

/**
 * Creates and returns a Stream of the words in the given text. Words are a
 * group of characters separated by one or more white spaces.
 *
 * @param text containing zero or more words
 * @return a Stream of the words in the given text
 */
public static Stream<String> wordsOf(String text) {
  requireNonNull(text);
  return WORDS.splitAsStream(text);
}
origin: biezhi/30-seconds-of-java8

public static String capitalizeEveryWord(final String input) {
  return Pattern.compile("\\b(?=\\w)").splitAsStream(input)
      .map(w -> capitalize(w, false))
      .collect(Collectors.joining());
}
origin: RichardWarburton/java-8-lambdas-exercises

public static Map<String, Long> countWordsIn(Path path) throws IOException {
  Stream<String> words = Files.readAllLines(path, defaultCharset())
                .stream()
                .flatMap(line -> SPACES.splitAsStream(line));
  return countWords(words);
}
origin: lettuce-io/lettuce-core

private static List<Integer> readSlots(List<String> slotStrings) {
  List<Integer> slots = new ArrayList<>();
  for (String slotString : slotStrings) {
    if (slotString.startsWith(TOKEN_SLOT_IN_TRANSITION)) {
      // not interesting
      continue;
    }
    if (slotString.contains("-")) {
      // slot range
      Iterator<String> it = DASH_PATTERN.splitAsStream(slotString).iterator();
      int from = Integer.parseInt(it.next());
      int to = Integer.parseInt(it.next());
      for (int slot = from; slot <= to; slot++) {
        slots.add(slot);
      }
      continue;
    }
    slots.add(Integer.parseInt(slotString));
  }
  return Collections.unmodifiableList(slots);
}
origin: lettuce-io/lettuce-core

/**
 * Parse partition lines into Partitions object.
 *
 * @param nodes output of CLUSTER NODES
 * @return the partitions object.
 */
public static Partitions parse(String nodes) {
  Partitions result = new Partitions();
  try {
    List<RedisClusterNode> mappedNodes = TOKEN_PATTERN.splitAsStream(nodes).filter(s -> !s.isEmpty())
        .map(ClusterPartitionParser::parseNode)
        .collect(Collectors.toList());
    result.addAll(mappedNodes);
  } catch (Exception e) {
    throw new RedisException("Cannot parse " + nodes, e);
  }
  return result;
}
origin: speedment/speedment

final AtomicInteger col = new AtomicInteger();
final List<String> words = splitter.splitAsStream(text).collect(toList());
for (final String w : words) {
  final int wordLen = w.length();
origin: speedment/speedment

final AtomicInteger col = new AtomicInteger();
splitter.splitAsStream(text)
  .map(w -> w.replace("\t", Formatting.tab()))
  .forEachOrdered(w -> {
origin: Vedenin/useful-java-links

    .splitAsStream("a1:a2:a3");
System.out.println("streamFromPattern = " + streamFromPattern.collect(Collectors.joining(","))); // print a1,a2,a3
origin: bootique/bootique

SPACE.splitAsStream(joined).forEach(word -> {
origin: lettuce-io/lettuce-core

private static RedisClusterNode parseNode(String nodeInformation) {
  Iterator<String> iterator = SPACE_PATTERN.splitAsStream(nodeInformation).iterator();
origin: stackoverflow.com

 Pattern pattern = Pattern.compile(", ");
List<Integer> list = pattern.splitAsStream(ints)
              .map(Integer::valueOf)
              .collect(Collectors.toList());
origin: stackoverflow.com

story = Pattern
   .compile(String.format("(?<=%1$s)|(?=%1$s)", "foo|bar"))
   .splitAsStream(story)
   .map(w -> ImmutableMap.of("bar", "foo", "foo", "bar").getOrDefault(w, w))
   .collect(Collectors.joining());
origin: ron190/jsql-injection

public static void initRequest(String request) {
  ParameterUtil.requestAsText = request;
  
  ParameterUtil.request =
    Pattern
      .compile("&")
      .splitAsStream(request)
      .map(s -> Arrays.copyOf(s.split("="), 2))
      .map(o -> new SimpleEntry<String, String>(o[0], o[1] == null ? "" : o[1]))
      .collect(Collectors.toList())
  ;
}
origin: ron190/jsql-injection

public static void initHeader(String header) {
  ParameterUtil.setHeader(
    Pattern
      .compile("\\\\r\\\\n")
      .splitAsStream(header)
      .map(s -> Arrays.copyOf(s.split(":"), 2))
      .map(o -> new SimpleEntry<String, String>(o[0], o[1] == null ? "" : o[1]))
      .collect(Collectors.toList())
  );
}
 
origin: shekhargulati/30-seconds-of-java

public static String capitalizeEveryWord(final String input) {
  return Pattern.compile("\\b(?=\\w)").splitAsStream(input)
      .map(w -> capitalize(w, false))
      .collect(Collectors.joining());
}
origin: neo4j-contrib/neo4j-apoc-procedures

/**
 * @param query
 * @return
 */
protected String toQueryParams(Object query) {
  if (query == null) return "";
  if (query instanceof Map) {
    Map<String, Object> map = (Map<String, Object>) query;
    if (map.isEmpty()) return "";
    return map.entrySet().stream().map(e -> e.getKey() + "=" + Util.encodeUrlComponent(e.getValue().toString())).collect(Collectors.joining("&"));
  } else {
    // We have to encode only the values not the keys
    return Pattern.compile("&").splitAsStream(query.toString())
        .map(KEY_VALUE::matcher)
        .filter(Matcher::matches)
        .map(matcher -> matcher.group(1) + matcher.group(2) + Util.encodeUrlComponent(matcher.group(3)))
        .collect(Collectors.joining("&"));
  }
}
origin: ron190/jsql-injection

public static void initQueryString(String urlQuery) throws MalformedURLException {
  URL url = new URL(urlQuery);
  if ("".equals(urlQuery) || "".equals(url.getHost())) {
    throw new MalformedURLException("empty URL");
  }
  
  ConnectionUtil.setUrlByUser(urlQuery);
  
  // Parse url and GET query string
  ParameterUtil.setQueryString(new ArrayList<SimpleEntry<String, String>>());
  Matcher regexSearch = Pattern.compile("(.*\\?)(.*)").matcher(urlQuery);
  if (regexSearch.find()) {
    ConnectionUtil.setUrlBase(regexSearch.group(1));
    if (!"".equals(url.getQuery())) {
      ParameterUtil.setQueryString(
        Pattern.compile("&").splitAsStream(regexSearch.group(2))
        .map(s -> Arrays.copyOf(s.split("="), 2))
        .map(o -> new SimpleEntry<String, String>(o[0], o[1] == null ? "" : o[1]))
        .collect(Collectors.toList())
      );
    }
  } else {
    ConnectionUtil.setUrlBase(urlQuery);
  }
}
origin: INRIA/spoon

.splitAsStream(tagBlock)
.filter(x -> !x.isEmpty())
.map(s -> BLOCK_TAG_PREFIX + s)
origin: stackoverflow.com

 public static Map<String, Integer> countJava8(String input) {
  return Pattern.compile("\\W+")
         .splitAsStream(input)
         .collect(Collectors.groupingBy(String::toLowerCase,
                         Collectors.summingInt(s -> 1)));
}
java.util.regexPatternsplitAsStream

Popular methods of Pattern

  • matcher
    Creates a matcher that will match the given input against this pattern.
  • compile
  • quote
    Returns a literal pattern String for the specifiedString.This method produces a String that can be u
  • split
    Splits the given input sequence around matches of this pattern. The array returned by this method co
  • pattern
  • matches
  • toString
    Returns the string representation of this pattern. This is the regular expression from which this pa
  • flags
    Returns this pattern's match flags.
  • asPredicate
  • <init>
    This private constructor is used to create all Patterns. The pattern string and match flags are all
  • closeImpl
  • compileImpl
  • closeImpl,
  • compileImpl,
  • closure,
  • error,
  • escape,
  • RemoveQEQuoting,
  • accept,
  • addFlag,
  • append

Popular in Java

  • Making http requests using okhttp
  • startActivity (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • onCreateOptionsMenu (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now