Removing comments, reformatting.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.baeldung.java9;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertSame;
|
||||
|
||||
|
||||
@@ -7,15 +7,15 @@ import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class OptionalToStreamTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testOptionalToStream(){
|
||||
public void testOptionalToStream() {
|
||||
Optional<String> op = Optional.ofNullable("String value");
|
||||
Stream<String> strOptionalStream = op.stream();
|
||||
Stream<String> filteredStream = strOptionalStream.filter(
|
||||
(str) -> { return str != null && str.startsWith("String"); }
|
||||
);
|
||||
Stream<String> filteredStream = strOptionalStream.filter((str) -> {
|
||||
return str != null && str.startsWith("String");
|
||||
});
|
||||
assertEquals(1, filteredStream.count());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.baeldung.java9;
|
||||
|
||||
|
||||
import java.util.Set;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -9,18 +8,18 @@ import static org.junit.Assert.assertEquals;
|
||||
public class SetExamplesTest {
|
||||
|
||||
@Test
|
||||
public void testUnmutableSet(){
|
||||
public void testUnmutableSet() {
|
||||
Set<String> strKeySet = Set.of("key1", "key2", "key3");
|
||||
try{
|
||||
try {
|
||||
strKeySet.add("newKey");
|
||||
}catch(UnsupportedOperationException uoe){
|
||||
} catch (UnsupportedOperationException uoe) {
|
||||
}
|
||||
assertEquals(strKeySet.size(), 3);
|
||||
assertEquals(strKeySet.size(), 3);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testArrayToSet(){
|
||||
Integer [] intArray = new Integer[]{1,2,3,4,5,6,7,8,9,0};
|
||||
public void testArrayToSet() {
|
||||
Integer[] intArray = new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
|
||||
Set<Integer> intSet = Set.of(intArray);
|
||||
assertEquals(intSet.size(), intArray.length);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user