refactored the maven project structure so that things are in a simpler tree structure to avoid folks getting lost

This commit is contained in:
James Strachan
2012-04-05 16:20:06 +01:00
parent 937b5ac16d
commit a40f9ee9b1
74 changed files with 99 additions and 45 deletions
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-project</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>kotlin-java-example</artifactId>
<description>This example shows how the standard kotlin API can be easily used from Java code;
its maybe more verbose and not as kool, but still very functional</description>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>stdlib</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,34 @@
package test.kotlin.jtests;
import static kotlin.namespace.*;
import static kotlin.util.namespace.*;
import jet.Function1;
import junit.framework.TestCase;
import java.util.Collection;
import java.util.List;
/**
* Lets try using the Kotlin standard library from Java code
*/
public class CollectionTest extends TestCase {
public void testCollections() throws Exception {
List<String> list = arrayList("foo", "bar");
String text = makeString(list, ",", "(", ")", -1, "...");
System.out.println("Have text: " + text);
assertEquals("(foo,bar)", text);
Collection<String> actual = filter(list, new Function1<String, Boolean>() {
@Override
public Boolean invoke(String text) {
return text.startsWith("b");
}
});
System.out.println("Filtered list is " + actual);
assertEquals("(bar)", makeString(actual, ",", "(", ")", -1, "..."));
}
}