Skip to content

Instantly share code, notes, and snippets.

@szeiger
Created October 8, 2018 21:31
Show Gist options
  • Save szeiger/ed122326db5c4fab0be781248b603563 to your computer and use it in GitHub Desktop.
Save szeiger/ed122326db5c4fab0be781248b603563 to your computer and use it in GitHub Desktop.
import scala.collection.immutable.HashMap$;
import scala.collection.immutable.HashMap;
import scala.collection.immutable.Map;
import scala.collection.mutable.Builder;
import scala.Tuple2;
public class JavaCallingScalaHashMap {
public static void main( String[] args ) {
Map<String, Integer> hashMap = HashMap$.MODULE$.empty();
Builder<Tuple2<String, Integer>, HashMap<String, Integer>> b = HashMap$.MODULE$.newBuilder();
b.addOne(new Tuple2<>("foo", 42));
Map<String, Integer> hashMap2 = b.result();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment