Core Java 8 refactor (#3342)
This commit is contained in:
committed by
GitHub
parent
2afc7dc623
commit
da4bd50cdb
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.streamApi;
|
||||
package com.baeldung.stream;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
@@ -16,7 +16,7 @@ public class StreamApi {
|
||||
}
|
||||
|
||||
public static String getLastElementUsingSkip(List<String> valueList) {
|
||||
long count = valueList.stream().count();
|
||||
long count = (long) valueList.size();
|
||||
Stream<String> stream = valueList.stream();
|
||||
return stream.skip(count - 1).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user