Untitled

 avatar
unknown
java
3 years ago
1.0 kB
3
Indexable
            else if(s.startsWith("Customer")){
                Iterator itr = objects.iterator();
                ArrayList<Product> products = new ArrayList<Product>();
                Object mainObject = new Object();

                while(itr.hasNext()){
                    Object element = itr.next();
                    if(((Person)element).getId() == Integer.valueOf(sList.get(1))){
                        mainObject = element;
                        sList.remove(0);
                        sList.remove(0);
                        for(int i = 0; i < sList.size(); i++){
                            for(Object obj2:objects){
                                if(obj2 instanceof Product){
                                    if (((Product)obj2).getProductName() == sList.get(i)){
                                        products.add((Product)obj2);
                                    }
                                }
                            }
                        }
                    }
                }
Editor is loading...