dimanche 25 octobre 2015

Java program evaluating twice

    public Iterator<IBookItem> findBooksBySeller(String seller) {
        for(int i = 0; i < sellerList.size(); i++){
            if(sellerList.get(i).equals(seller))
            {
                System.out.println("The seller: " + seller + " has the following books for sale: " + titleList.get(i) + " £" + priceList.get(i));
                System.out.println("-----------------------------------------------");

            }

        }
        System.out.println("The Seller: " + seller + " has no Books for Sale");
        System.out.println("--------------------------------------------");
        return null;

    }

This is my code and it prints out both statements, could someone pleases tell me why?

Aucun commentaire:

Enregistrer un commentaire