Questions tagged [lightweight-stream-api]

Use this tag for questions specific to Lightweight-Stream-API which is a stream API from Java 8 rewritten on iterators for Java 7 and below.

18 questions
7
votes
4 answers

Java Stream: How to avoid add null value in Collectors.toList()?

There is some Java code: List updatedList = updatingUniquedList .stream() .map(s -> { Call call = callsBufferMap.get(s); } return call; }).collect(Collectors.toList()); How to avoid avoid to add to…
harp1814
  • 1,494
  • 3
  • 13
  • 31
3
votes
0 answers

How to reduce the parsing time of Message pack library when unpacking the huge data

I am using message-pack lib (https://github.com/msgpack/msgpack-java) for an android app and unpacking the data from streaming apis form the received InputStream. The transmission is fast and overall it works good, but the at the client side (i.e.…
3
votes
1 answer

Rewrite java 8 method with Lightweight-Stream-API for using for api 21

I don't know all capabilities of Stream API. I have an AutoCompleteTextView with custom adaptor,I made a method that know if entered data in AutoCompleteTextView is from suggested data or not , Now I want rewrite it using Lightweight-Stream-API for…
2
votes
1 answer

Trading veiw Lightweight graph set timescale at one hour

I am currently using lightweight chart for my candlestick graph but i am facing an issue . How can i set my data in candle stick. My data. "data": [ { "open": "1.18384", "high": "1.1845", "low": "1.18368", "close": "1.18429", …
2
votes
1 answer

sortBy in descending order in Lightweight-Stream-API

I'm trying to use Lightweight-Stream-API for supporting less than API-24. It works with ascending order but how to do it descending sortBy(). List persons = Arrays.asList( new Person("Bill", 30), new…
Asim Roy
  • 9,915
  • 4
  • 28
  • 40
1
vote
0 answers

SubString in List

I have a class and method class Dictionary { public Dictionary(List dic) { // ... } public int getCount(String substr) { // ... } } What should occur: in method getCount you need to use list from…
1
vote
1 answer

Concat stream lines before collecting them

Simply, the code below produces a stream of five lines, I need to concat these lines into one line (while streaming) for further use and before collecting them.The code is about to convert a character string into one long binary…
FSm
  • 2,017
  • 7
  • 29
  • 55
1
vote
1 answer

How to group map values after Collectors.groupingBy() without using forEach

I have a list of ProductDto objects and I want to group them the similar ones using java 8 streams Collectors.groupingBy(). After grouping the records I want to combine the similar records as single productDto. To achieve this I have used…
1
vote
3 answers

Get max and maxIndex of sum of two lists of floats in java fast

I am trying to calculate the max sum pair of two lists with a faster way than what i've managed below, using "lightweight streams": List pairsSum = new ArrayList<>(); // Get the list with all the sums Stream.range(0, list1.size()) …
angelos_lex
  • 1,593
  • 16
  • 24
0
votes
3 answers

How to groupBy and its count list of items into Map object in Java?

I have a list of Booking and this Booking has field OfficeType as enum as follow @Data @Entity @TypeDef(name = "json", typeClass = JsonStringType.class) public class Booking { @Id @GeneratedValue(generator = "uuid2") @GenericGenerator(name =…
abidinberkay
  • 1,857
  • 4
  • 36
  • 68
0
votes
1 answer

JAVA 8 distinctByKey

public List getFilteredList(List l1) { return l1 .stream() .filter(distinctByKey(XYZ::getName)) .filter(distinctByKey(XYZ::getPrice)) .collect(Collectors.toList()); …
0
votes
1 answer

Java 8 Stream query - need to replace if inside for each with some streams method

request .getCustomer() .stream() .filter(custDetails -> custDetails.getCorrespondenceAddress() != null) .forEach( custDetails -> { if (validateNotNull( …
0
votes
2 answers

Filtering Java Nested List

I've a school list which contains class, class list which also contains student and student are also another list. I want to apply two nested filter which first will check that if any class have a empty student list and second filter is for checking…
ccznyo
  • 1
  • 1
0
votes
1 answer

How can I group Stream into Stream>, not into Map>?

I have POJO class: @Data @AllArgsConstructor public class Person { private String name; private String surname; } I have some executable code: public class Main { public static void main(String[] args) { Person john1 = new…
0
votes
1 answer

Get index where the element matches using lightweight stream API stream

I have the following stream and I am using this library for streams: String itemDescValue = Stream.of(dtaArr).filter(e -> e.getRateUID().equals(rateUID)) .map(myObject::getItemDesc) .findFirst() …
xyz16179
  • 23
  • 6
1
2