Conditional Stream merges if/else, switch/case statements and finally block in a single stream of given generic type object.
Method names cannot be same with Java Language Keywords, so the method names of Conditional Stream are little different from keywords but not that much.
-
Perform function if given condition returns true.
-
Perform function if stream object and given object are equal.
-
Classic else statement.
-
Performs given function without condition and finishes the stream.
-
Changes stream type to return type of given function.
-
Casts stream type to given type.
-
Returns final value of stream object as type of stream.
Download the latest JAR
<dependency>
<groupId>com.github.kaygisiz</groupId>
<artifactId>conditional-stream</artifactId>
<version>0.2</version>
<type>pom</type>
</dependency>
implementation 'com.github.kaygisiz:conditional-stream:0.2'
compile("com.github.kaygisiz:conditional-stream:0.2")
Copyright (C) 2019 Necati Caner Gaygisiz
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.