(I am a beginner so if I called something wrong ply correct me) I made an ArrayList from different Objects. But I don't know how can I change a specific Object on my ArrayList. For example, change population from 80 to 85 in below example. Contractor:
class constructor {
private Contry contry;
private BigDecimal population;
private String capital ;
public constructor(Contry contry, BigDecimal population, String capital){
this.contry = contry;
this.population = population;
this.capital = capital;
}
and my method:
public class ContryInfo {
public List<constructor> information(Contry contry, BigDecimal population,
String capital) {
List<constructor> contriesInfo = new ArrayList<>();
contriesInfo.add(new constructor(contry, population, capital));
return Information
and my main
public static void main(String[] args) {
List<constructor> exampleList = new ArrayList<>();
exampleList = new ContryInfo().Information(Germany, new BigDecimal("80"), "Berlin");
I tried to use stream().map but wasn't successful to find a way. Will be happy if you guys write the solution to my problem.