How can I update an arrayList that contains multiple values?? Thanks : I am creating a basket that stores into an arraylist (Item key, qty and the price of the item). How can I update just the quantity and not to create another line with the same Item key.
Here is the outcome that the program below does. Thanks for your help!!1

Java Book		          1   £48.90

Samsung Galaxy S7		  1   £639.50


Speakers		          3   £59.80


Java Book		          2   £48.90


Samsung Galaxy S7		  2   £639.50

//////////////////////////////////////////////////


private void ItemsBasket(String name, int qty, String key) throws HeadlessException {

        if (name == null) {
            JOptionPane.showMessageDialog(null, "Please Selecet a key");
            String imageFileName = "./images/" + key + ".png";
            File imageFile = new File(imageFileName);

            if (!imageFile.exists()) {
                imageFileName = "./images/empty.png";
            }

        } else if (qty <= StockData.getQuantity(key)) {

   
            arList.add(StockData.getName(key) + "\t\t  " + qty + "   " + pounds.format(StockData.getPrice(key)));

            bagtotal += StockData.getPrice(key) * qty;

            JOptionPane.showMessageDialog(null, "Sucessfully added to the basket");

        } else {
            JOptionPane.showMessageDialog(null, "Insuffcient stock");
            JOptionPane.showMessageDialog(null, "Available items qty : " + "**" + StockData.getQuantity(key) + "**");

        }
    }