Sc8 - Scala Functions For Java 8

Using Scala libraries from Java 8 can be difficult, because Scala's functions are traits, and not recognised as a FunctionalInterface by the Java compiler. Sc8 is a simple conversion library that converts Java lambdas to Scala functions.

Лицензия

Лицензия

Группа

Группа

com.github.eirslett
Идентификатор

Идентификатор

sc8
Последняя версия

Последняя версия

0.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Sc8 - Scala Functions For Java 8
Using Scala libraries from Java 8 can be difficult, because Scala's functions are traits, and not recognised as a FunctionalInterface by the Java compiler. Sc8 is a simple conversion library that converts Java lambdas to Scala functions.
Ссылка на сайт

Ссылка на сайт

https://github.com/eirslett/sc8
Система контроля версий

Система контроля версий

https://github.com/eirslett/sc8

Скачать sc8

Имя Файла Размер
sc8-0.1.0.pom
sc8-0.1.0.jar 75 KB
sc8-0.1.0-sources.jar 15 KB
sc8-0.1.0-javadoc.jar 189 KB
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.eirslett/sc8/ -->
<dependency>
    <groupId>com.github.eirslett</groupId>
    <artifactId>sc8</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.eirslett/sc8/
implementation 'com.github.eirslett:sc8:0.1.0'
// https://jarcasting.com/artifacts/com.github.eirslett/sc8/
implementation ("com.github.eirslett:sc8:0.1.0")
'com.github.eirslett:sc8:jar:0.1.0'
<dependency org="com.github.eirslett" name="sc8" rev="0.1.0">
  <artifact name="sc8" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.eirslett', module='sc8', version='0.1.0')
)
libraryDependencies += "com.github.eirslett" % "sc8" % "0.1.0"
[com.github.eirslett/sc8 "0.1.0"]

Зависимости

provided (1)

Идентификатор библиотеки Тип Версия
org.scala-lang : scala-library jar 2.10.0

test (2)

Идентификатор библиотеки Тип Версия
com.twitter : util-core_2.10 jar 6.4.0
junit : junit jar 4.11

Модули Проекта

Данный проект не имеет модулей.

THIS PROJECT IS OUTDATED

3 years after making this project, Scala 2.12 has finally been released, with built-in full interop between Java 8 and Scala! 😄

Sc8 - Scala functions in Java 8

Using Scala libraries from Java 8 can be difficult, because Scala's functions are traits, and not recognised as a FunctionalInterface by the Java compiler. Sc8 is a simple conversion library that converts Java lambdas to Scala functions.

Install via Maven

<dependency>
  <groupId>com.github.eirslett</groupId>
  <artifactId>sc8</artifactId>
  <version>0.1.0</version>
</dependency>

Using the library

In your Java file, import F (and/or C if required):

import static com.github.eirslett.sc8.Sc8.C;
import static com.github.eirslett.sc8.Sc8.F;

What you have to do, is to wrap your lambda with F(...), for example:

result = someList.map(F(s -> s.toUpperCase()));

The F function converts the lambda into a Scala function for you. If your lambda returns void, use C instead:

myFuture.onSuccess(C(s -> System.out.println(s)));

Examples

Look at the tests for more examples.

Building

You need Java 8 and Maven to build this project. (Get Java 8 here: https://jdk8.java.net/download.html)

$ mvn clean package

If you don't want to install jdk8 globally, you can put it in a folder "jdk1.8.0" inside this project, and build with the "localjdk" profile:

$ mvn clean package -Plocaljdk

Generating sources

The Java and Scala sources are for the most part auto-generated, by the PHP-script "genfuncs.php". To generate sources, you will need PHP. Run $ php genfuncs.php to generate.

Версии библиотеки

Версия
0.1.0