Removing comments, reformatting.
This commit is contained in:
parent
f1cfc706df
commit
be6939bd97
|
@ -60,12 +60,8 @@
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.9</source>
|
<source>1.9</source>
|
||||||
<target>1.9</target>
|
<target>1.9</target>
|
||||||
|
|
||||||
<verbose>true</verbose>
|
<verbose>true</verbose>
|
||||||
<!-- <executable>C:\develop\jdks\jdk-9_ea122\bin\javac</executable>
|
|
||||||
<compilerVersion>1.9</compilerVersion> -->
|
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -85,12 +81,7 @@
|
||||||
|
|
||||||
|
|
||||||
<!-- maven plugins -->
|
<!-- maven plugins -->
|
||||||
<!--
|
<maven-compiler-plugin.version>3.6-jigsaw-SNAPSHOT</maven-compiler-plugin.version>
|
||||||
<maven-war-plugin.version>2.6</maven-war-plugin.version>
|
|
||||||
maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version> -->
|
|
||||||
<maven-compiler-plugin.version>3.6-jigsaw-SNAPSHOT</maven-compiler-plugin.version>
|
|
||||||
|
|
||||||
|
|
||||||
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
|
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
|
||||||
|
|
||||||
<!-- testing -->
|
<!-- testing -->
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.baeldung.java9;
|
package com.baeldung.java9;
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertSame;
|
import static org.junit.Assert.assertSame;
|
||||||
|
|
||||||
|
|
|
@ -7,15 +7,15 @@ import org.junit.Test;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class OptionalToStreamTest {
|
public class OptionalToStreamTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOptionalToStream(){
|
public void testOptionalToStream() {
|
||||||
Optional<String> op = Optional.ofNullable("String value");
|
Optional<String> op = Optional.ofNullable("String value");
|
||||||
Stream<String> strOptionalStream = op.stream();
|
Stream<String> strOptionalStream = op.stream();
|
||||||
Stream<String> filteredStream = strOptionalStream.filter(
|
Stream<String> filteredStream = strOptionalStream.filter((str) -> {
|
||||||
(str) -> { return str != null && str.startsWith("String"); }
|
return str != null && str.startsWith("String");
|
||||||
);
|
});
|
||||||
assertEquals(1, filteredStream.count());
|
assertEquals(1, filteredStream.count());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.baeldung.java9;
|
package com.baeldung.java9;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -9,18 +8,18 @@ import static org.junit.Assert.assertEquals;
|
||||||
public class SetExamplesTest {
|
public class SetExamplesTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnmutableSet(){
|
public void testUnmutableSet() {
|
||||||
Set<String> strKeySet = Set.of("key1", "key2", "key3");
|
Set<String> strKeySet = Set.of("key1", "key2", "key3");
|
||||||
try{
|
try {
|
||||||
strKeySet.add("newKey");
|
strKeySet.add("newKey");
|
||||||
}catch(UnsupportedOperationException uoe){
|
} catch (UnsupportedOperationException uoe) {
|
||||||
}
|
}
|
||||||
assertEquals(strKeySet.size(), 3);
|
assertEquals(strKeySet.size(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testArrayToSet(){
|
public void testArrayToSet() {
|
||||||
Integer [] intArray = new Integer[]{1,2,3,4,5,6,7,8,9,0};
|
Integer[] intArray = new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
|
||||||
Set<Integer> intSet = Set.of(intArray);
|
Set<Integer> intSet = Set.of(intArray);
|
||||||
assertEquals(intSet.size(), intArray.length);
|
assertEquals(intSet.size(), intArray.length);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue