Verloren voorwerpen

Sign in to test your solution.
import java.util.ArrayList; public class Opslag { private int volgendIdentificatienummer; private ArrayList<Voorwerp> voorwerpen; public Opslag() { volgendIdentificatienummer = 0; voorwerpen = new ArrayList<Voorwerp>(); } public void voorwerpToevoegen(String type, String omschrijving) { voorwerpen.add(new Voorwerp(tellerIdentificatienummer,type, omschrijving)); tellerIdentificatienummer ++; } public int zoekVerlorenVoorwerp(int identificatienummer) { int index = 0; while (index < voorwerpen.size() && voorwerpen.get(index).getIdentificatienummer() != identificatienummer) { index++; } if(index == voorwerpen.size()) { index = -1; } return index; } }
You can submit as many times as you like. Only your latest submission will be taken into account.
Sign in to test your solution.