Skip to main content

All Questions

Tagged with
0 votes
1 answer
61 views

how to efficiently check common elements of two lists of different types ( class A and class B) and make a resultant list of type A for all matches

I have a list of class A with 1000 elements that has all unique ids. There is some other Class B , which also has a unique id parameter and this B is a json property of Class A. the relation is like : ...
raga_717's user avatar
0 votes
1 answer
64 views

Read nested list with other attributes in Java streams

I have a list of object for example Person in turn have couple of lists with few generic attributes like below List<Address> address1 = List.of("1","2","5","6&...
rev gan's user avatar
  • 87
0 votes
0 answers
73 views

How could you generate all permutations of ABC with no repeats for any length?

So if I had a list of String[] list = {A,B,C}; generateAllCombonations(list); would return: ABC ACB BAC BCA CAB CBA for any length of the list? AAB would not be allowed given no repeats also, AB would ...
AceNutella's user avatar
0 votes
4 answers
546 views

Streams use for map computation from list with counter

I have the following for loop which I would like to replace by a simple Java 8 stream statement: List<String> words = new ArrayList<>("a", "b", "c"); Map<...
Pepe's user avatar
  • 311
1 vote
0 answers
119 views

After reading list containing objects using ObjectInputStream how to iterate through the list?

I have a binary file having some list where each list has group of similar objects I am using ObjectInputStream to read the list series one by one Now, instead of directly printing the list I want to ...
Payel Senapati's user avatar
0 votes
0 answers
14 views

displaying values in tabular format [duplicate]

displaying List in tabular format but somewhere I am doing wrong. a.jsp List<String> abc = (ArrayList<String>)request.getAttribute("studentsrollno"); // got studentsrollno from ...
Tom's user avatar
  • 771
0 votes
1 answer
29 views

Comparing nested lists within a parent list structure for values in specific indices in java

Given a list of lists in the following format: List < List < String, String, BigInteger, String, String, String, String, String, String > > rows what would be the best way to iterate through ...
dxlachx's user avatar
1 vote
1 answer
72 views

Iterating through a list which is an object of a table

public List<AnswerValues> getAllAnswers(Forms fm){ Session sess = getSession(); Criteria crit = sess.createCriteria(FormQuestions.class); crit.add(Restrictions.eq("fkformId",fm)); ...
bahdotsh's user avatar
  • 467
1 vote
2 answers
73 views

Java - Retrive Indivudual Values from a List in a Map

I have a TreeMap with 3 entries, all from individual ArrayLists. I use the following code: Map<String, List<String>> mapOne = new TreeMap<String, List<String>>(); List<...
rainer's user avatar
  • 3,411
0 votes
0 answers
52 views

Iterating over a list of array objects (trying to make code more concise)

I currently have the following code: if (task5.isVisible()) { if (!task1.isVisible()) { task1.setVisible(true); checkBox1.setVisible(true); } else if (!task2.isVisible()) { ...
Krish's user avatar
  • 37
-1 votes
1 answer
41 views

Excluding an integer from an array to find the 2nd smallest

I have an assignment where my prof. will input an unspecified number of integers into my program, and my program will process the data accordingly to assign a grade to each value and find the highest ...
Tyler Judon's user avatar
-3 votes
1 answer
1k views

Java 8 Streams for List iteration

I have a HashMap that contains List<Dto> and List<List<String>>: Map<List<Dto>, List<List<String>>> mapData = new HashMap(); and an Arraylist<Dto>. I ...
Renuka hr1084's user avatar
0 votes
1 answer
727 views

LinkedList - Get current and previous when traversing

I have a LinkedList, and need to know the current, previous, and next item when iterating thru it. I guess there is no way to do this with the "for each" notation, so I turned to list iterators. They ...
watchonface's user avatar
3 votes
2 answers
101 views

How to do a nested iteration over an abstract list efficiently?

I'm trying to replicate the typical construct of "walking the upper diagonal matrix of the self Cartesian product", with a list as a source. In layman terms, if I have an array a I want to do this: ...
fortran's user avatar
  • 76.2k
-2 votes
2 answers
725 views

Java: For loop on Objects of Strings

I'm new in Java and I have to solve this exercise. I have this code: public class StringList { private String list = ""; public StringList(String... str) { for (...
tersan's user avatar
  • 7

15 30 50 per page