Set of Java utils that I take along with my OSS java projects. Most of them are influenced from Scala world and Guava library. Library has zero external dependencies. If you find some implementations can be better, please do let me know.
- Lists#map
- Lists#filter
- Lists#foldL
- Lists#find
- Lists#mkString
- Lists#Nil
- Lists#concat
- Lists#flatten
- Lists#take
- Lists#takeWhile
- Sets#copy
- Sets#isEmpty
- Sets#nonEmpty
- Iterables#exists
- Iterables#forall
- Iterables#head
- Iterables#headOption
- Iterables#isEmpty
- Iterables#nonEmpty
- Iterables#toMap
- Iterables#foreach
- Maps#of
- Maps#builder
- Maps#empty
- Maps#getOrElse
- Option / Some / None
- Tuple2 / Tuple3
- Function
- Predicate
- Functions#identity
- Functions#STDOUT
- Functions#STDERR
- Predicates#True
- Predicates#False
- StringUtils#isNotEmpty
- StringUtils#isEmpty
- StringUtils#startsWith
- StringUtils#endsWith
- StringUtils#size
- StringUtils#trim
- StringUtils#isBlank
- StringUtils#isNotBlank
- IO#fromFile
- IO#linesFromFile
- IO#linesFromInputStream
Parser<String> parser = Literal("input");
ParserResult<String> result = parser.parse("input is awesome"); // returns Success<String>
ParserResult<String> result = parser.parse("output is awesome"); // returns Failure<String>
Inspired from Scala's Parser Combinator and JS Parsimmon. Take a look at TemplateParser, it's implemented using this parser package.
- Parsers#Literal
- Parsers#Character
- Parsers#Integer
- Parsers#Double
- Parsers#Regex
- Parsers#Sequence
- Parser#map
- Parser#thenR
- Parser#thenL
- Parser#then
- Parser#or
- Parser#debug
- Parser#skip
Supports #{variable}
and #{variable?default}
type syntax based rendering. Inspired from sbt-editsource plugin.
For Maven,
<dependency>
<groupId>in.ashwanthkumar</groupId>
<artifactId>my-java-utils</artifactId>
<version>0.1.0</version>
</dependency>
For SBT,
libraryDependencies += "in.ashwanthkumar" % "my-java-utils" % "0.1.0"