Wiki

Clone wiki

dollar-lang / Home

Dollar-lang

Dollar-lang is inspired by dollar, Scala, and Nat Pryce's Maybe class.

Lists

Provides short-cuts for creating instances of ArrayList. Usage:

 List<String> list = $();
 List<String> names = $("bob", "sam");
 List<Long> ids = $(12345678L, 654321L);
 List<Number> numbers = $(1, 2L, 3L, 4, 5.0); 

Tuples

Create tuples with Tuple.of(x, y) OR Tuple.t(x, y), which can be shortened to t(x, y).

import static org.bitbucket.dollar.lang.Tuple.t;
//...
 Tuple2<Long, String> pair = t(1L, "foo");

Maybe

Contains a modified copy of Nat Pryce's Maybe (from a fork on github located at https://github.com/youdevise/maybe-java)

Dependency Management

Gradle:

        compile 'org.bitbucket.dollar:dollar-lang:1.0-beta3'

Maven:

    <dependency>
            <groupId>org.bitbucket.dollar</groupId>
            <artifactId>dollar-lang</artifactId>
            <version>1.0-beta3</version>
    </dependency>

Changes

1.0-beta3

  • changed m$ to $ in Maybe
  • added List<Tuple2> zip(List list1, list2) and unzip(List<Tuple2>), etc... methods to Lists
  • changed names of all parameters to be more meaningful
  • Added more Tuples: up to Tuple7
  • Depends on dollar:1.0-beta3

Updated