Jack Stha

Greenhorn
+ Follow
since Sep 23, 2016
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jack Stha

When i add the value from arraylist dealt to arraylist dealt 1 And remove from arraylist dealt.....
i continously do this process
it should be saved like [card@123,card@1312,card@123123]

but instead it saves only 1 value overwriting the pervious values
i.e [card@123123]
7 years ago
Arraylist<Card> data is equal to Arraylist<Card> dealt i did this so i could do my work easily
now i add the values of dealt(data) of index 0 in arraylist<Card> dealt1 and remove from arraylist dealt.
now when i again do this the values in arraylist dealt is replaced  by new one only 1 value stay in that list
7 years ago
the value which i store in Arraylist are being replaced by new values

public class Dealt{
   ArrayList<card> dealt;
   Arraylist<card> dealt1;

   public Dealt(Arraylist<card> data){
     dealt1= new ArrayList<>();
     dealt=data;
     dealt1.add(dealt.get(o));    //I had added object of card in data.
     dealt.remove(o));
   }

}

when i do this it replaces old value with new value.
7 years ago