All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jaskell.parsec.common.JoinText Maven / Gradle / Ivy

Go to download

This is a utils library for java 8 project. It include parsec combinators and sql generators library.

There is a newer version: 2.9.2
Show newest version
package jaskell.parsec.common;

import static java.util.stream.Collectors.joining;

import java.util.List;
import java.util.stream.Collector;

/**
 * Created by Mars Liu on 16/9/13.
 * JoinText is a binder. It join Character List to String.
 */
public class JoinText
    implements Binder, String> {
  private final String sep;
  @Override
  public Parsec bind(List value) {
    Collector j = sep == null ? joining() : joining(sep);
    return state -> value.stream().map(Object::toString).collect(j);
  }

  public JoinText() {
    sep = null;
  }

  public JoinText(String sep) {
    this.sep = sep;
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy