Linked Questions

0 votes
1 answer
2k views

I have 2 lists codeList and nameList both having String elements. codeList = ["1", "2", "3"]; nameList = ["One", "Two", "Three"]; I ...
Akash Sharma's user avatar
0 votes
1 answer
670 views

I am very new to java and I am currently trying to recreate some python code in java. This is my problem: I have 2 different variables: ArrayList <Double> x_loc= new ArrayList<>(); ...
J.Doe's user avatar
  • 549
-1 votes
2 answers
485 views

I have a class public class Person{ private String name; private Integer age; } And i also have two lists: List<String> names = List.of("Mike", "Piter", "Jack&...
Pikachu's user avatar
  • 339
-2 votes
1 answer
42 views

List<String> list1=new ArrayList<String>(); list1.add("1"); list1.add("2"); list1.add("3"); list1.add("4"); List<String> list2=new ArrayList<String>(); ...
kero99's user avatar
  • 39
173 votes
14 answers
116k views

In JDK 8 with lambda b93 there was a class java.util.stream.Streams.zip in b93 which could be used to zip streams (this is illustrated in the tutorial Exploring Java8 Lambdas. Part 1 by Dhananjay Nene)...
artella's user avatar
  • 5,128
50 votes
5 answers
29k views

I recently saw some Clojure or Scala (sorry I'm not familiar with them) and they did zip on a list or something like that. What is zip and where did it come from ?
Robert Gould's user avatar
  • 70.1k
24 votes
6 answers
21k views

Using Google Guava (Google Commons), is there a way to merge two equally sized lists into one list, with the new list containing composite objects of the two input lists? Example: public class ...
Steve Kuo's user avatar
  • 63.3k
4 votes
2 answers
19k views

Is there any easy and quick way to merge 2 java vectors to 1? For example if I have: Vector<Object> Va = (Vector<Object>)Return_Vector_with_Objs(); Vector<Object> Vb = (Vector&...
user avatar
3 votes
4 answers
2k views

suppose I have these two lists List<Person> persons = Arrays.asList( new Person(1, "Mike", "Canada"), new Person(2, "Jill", "England"), new ...
StillLearningToCode's user avatar
0 votes
2 answers
1k views

I have a simple class: public class Thing { Long id; String color; String size; } I have two List<Thing> objects that looks like this: List<Thing> colors = [{2, red}, {3, blue}]; ...
IVR Avenger's user avatar
  • 15.6k
0 votes
1 answer
893 views

Note: I am not referring to the java enum/enumeration but rather how to associate the ordinal/index of each element in a collection with the element. I am looking for the equivalent of : scala : (1 ...
WestCoastProjects's user avatar
2 votes
2 answers
776 views

Is there any equivalent of zip method from pyton in java? a = ("John", "Charles", "Mike") b = ("Jenny", "Christy", "Monica") x = zip(a, b) ...
user avatar
1 vote
2 answers
828 views

I have 2 lists: List1: Object1 (Empno1, Empname1,Salary1) List2: Object2(Empno2, Empname2,Salary2) Object3(Empno3, Empname3,Salary3) Given the size of List1 is not same as List2. I want to iterate ...
Spandhana Vunnam's user avatar
0 votes
1 answer
159 views

In my servlet I have the following. All four are ArrayList<>, each with 5 values. request.setAttribute("interestEarnList", interestEarnList); request.setAttribute("numYear", numYear); ...
FeCH's user avatar
  • 133
-1 votes
1 answer
91 views

I have two lists as below: List ids = Arrays.asList(1,2,3); List reps = Arrays.asList("abc","pqr","xyz"); Now I want to create list of Prediction objects with values ...
user3812288's user avatar