diff --git a/kala-base/src/main/java/kala/collection/base/primitive/PrimitiveMapIterator.java b/kala-base/src/main/java/kala/collection/base/primitive/PrimitiveMapIterator.java new file mode 100644 index 00000000..431c8747 --- /dev/null +++ b/kala-base/src/main/java/kala/collection/base/primitive/PrimitiveMapIterator.java @@ -0,0 +1,22 @@ +/* + * Copyright 2024 Glavo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package kala.collection.base.primitive; + +import kala.collection.base.MapIterator; + +public interface PrimitiveMapIterator extends MapIterator { + +} diff --git a/src/test/java/kala/control/OptionTest.java b/src/test/java/kala/control/OptionTest.java index e38c1f35..28d0742f 100644 --- a/src/test/java/kala/control/OptionTest.java +++ b/src/test/java/kala/control/OptionTest.java @@ -1,33 +1,48 @@ -package kala.control; - -import org.junit.jupiter.api.*; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.util.Arrays; - -import static org.junit.jupiter.api.Assertions.*; - -public class OptionTest { - Option[] opts = new Option[]{ - Option.none(), - Option.some("foo"), - Option.some(10), - Option.some(Arrays.asList("A", "B", "C")), - Option.some(null) - }; - - @Test - public void serializationTest() { - assertAll(Arrays.stream(opts).map(opt -> () -> { - ByteArrayOutputStream out = new ByteArrayOutputStream(512); - new ObjectOutputStream(out).writeObject(opt); - byte[] buffer = out.toByteArray(); - ByteArrayInputStream in = new ByteArrayInputStream(buffer); - Object obj = new ObjectInputStream(in).readObject(); - assertEquals(opt, obj); - })); - } -} +/* + * Copyright 2024 Glavo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package kala.control; + +import org.junit.jupiter.api.*; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.Arrays; + +import static org.junit.jupiter.api.Assertions.*; + +public class OptionTest { + Option[] opts = new Option[]{ + Option.none(), + Option.some("foo"), + Option.some(10), + Option.some(Arrays.asList("A", "B", "C")), + Option.some(null) + }; + + @Test + public void serializationTest() { + assertAll(Arrays.stream(opts).map(opt -> () -> { + ByteArrayOutputStream out = new ByteArrayOutputStream(512); + new ObjectOutputStream(out).writeObject(opt); + byte[] buffer = out.toByteArray(); + ByteArrayInputStream in = new ByteArrayInputStream(buffer); + Object obj = new ObjectInputStream(in).readObject(); + assertEquals(opt, obj); + })); + } +} diff --git a/src/test/java/kala/control/primitive/BooleanOptionTest.java b/src/test/java/kala/control/primitive/BooleanOptionTest.java index d3d46f2f..b6012769 100644 --- a/src/test/java/kala/control/primitive/BooleanOptionTest.java +++ b/src/test/java/kala/control/primitive/BooleanOptionTest.java @@ -1,26 +1,40 @@ -package kala.control.primitive; - -import kala.control.primitive.BooleanOption; -import org.junit.jupiter.api.Test; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.util.stream.Stream; - -import static org.junit.jupiter.api.Assertions.*; - -public class BooleanOptionTest { - @Test - public void serializationTest() { - assertAll(Stream.of(BooleanOption.True, BooleanOption.False, BooleanOption.None).map(opt -> () -> { - ByteArrayOutputStream out = new ByteArrayOutputStream(512); - new ObjectOutputStream(out).writeObject(opt); - byte[] buffer = out.toByteArray(); - ByteArrayInputStream in = new ByteArrayInputStream(buffer); - Object obj = new ObjectInputStream(in).readObject(); - assertSame(opt, obj); - })); - } -} +/* + * Copyright 2024 Glavo + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package kala.control.primitive; + +import org.junit.jupiter.api.Test; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.*; + +public class BooleanOptionTest { + @Test + public void serializationTest() { + assertAll(Stream.of(BooleanOption.True, BooleanOption.False, BooleanOption.None).map(opt -> () -> { + ByteArrayOutputStream out = new ByteArrayOutputStream(512); + new ObjectOutputStream(out).writeObject(opt); + byte[] buffer = out.toByteArray(); + ByteArrayInputStream in = new ByteArrayInputStream(buffer); + Object obj = new ObjectInputStream(in).readObject(); + assertSame(opt, obj); + })); + } +}