What are the functionalities in using Java queryForStream? I generally use jbdcTemplate.query to obtain data from a database. I'm trying to understand the speci
How can I determine both the min and max of different attributes of objects in a stream? I've seen answers on how get min and max of the same variable. I've als
I'm trying to find best way to convert List of Integers to JSONArray of org.json.JSONArray library for API call. For that purpose I'm trying to implement stream
I have a List<String> emails containing emails, and another List<String> keywords for containing keywords. For each i-th value from keywords, there
Consider the signature of the concurrentGroupBy: static <T,K> Collector<T,?,ConcurrentMap<K,List<T>>> groupingByConcurrent(Function<
List<Emp> list = Arrays.asList( new Emp(123, "ABC"), new Emp(123, "BCD"), new Emp(1243, "AUBC"),
I have a fun puzzler. Say I have a list of String values: ["A", "B", "C"] Then I have to query another system for a Map<User, Long> of users with an attr
I want to find a target sum in an array by adding integers until it's reached, then return the indexes which add up to the target by using streams. For example,
I have this piece of code : Map<String, BillingAccount> billingAccountsMap = new HashMap<>(); for (BillingAccount ba : billingAccounts) { if (ba
This is probably very basic, but I am not a Java person. Here is my processing code which simply prints and sleeps: private static void myProcessings(int va
Let's say we have the following method. void some(int id, int... otherIds) { } How can I create a single IntStream with those two arguments?
Suppose we have an excel spreadsheet that looks like: StatusCount FirstName LastName ID 1 Tod Mahones 122145 0 Tod Maho
I get a stream of some custom objects and I would like to create a map Map<Integer, MyObject> with index of each object as key. To give you a simple examp
I'm trying to achieve this using only functional programming constructs (Streams, Collectors, lambda expressions). Let's say list is a String[]: {"Apple", "Sa
I have a class that for which each instance has a unique Id, a name and update date. ID NAME UPDATE DATE 1200 ANNA* 2022-03-01 1300 JONH* 2022-04-01 1200 ANNA*
In the code shown below, p is a predicate of type Predicate<String>. Map<Boolean, List<String>> partitioned = numbers.stream() .collect(Co
I have a list of objects from the database and i want to filter this list using the filter() method of the Stream class. New objects will be added to the databa
I'm trying to filter a List of objects that implements an interface. And I'm trying to create a generic method for all the classes. Something like: interface So
Experimenting with streams I ran into the following behavior which I don't quite understand. I created a parallel stream from an iterator and I noticed that it
I have one string say "Aniruddh" and I want to reverse it using lambdas and streams in Java 8. How can I do it?