All pastes #61028 Raw Edit

Untitled

public text v1 · immutable
#61028 ·published 2006-06-02 14:09 UTC
rendered paste body
				ArrayList finalList = new ArrayList();
				
				//Let's get the first list in the master list to use for
				//a guide for checking if the other lists contain matching store numbers
				if(!masterList.isEmpty() && masterList != null)
				{
					ArrayList storeList = (ArrayList)masterList.get(0); 
				
					for(int i = 0;i < masterList.size();i++)
					{
						ArrayList tempList = (ArrayList)masterList.get(i);
					
						for(int x = 0; x < storeList.size();x++)
						{
							if(tempList.contains(storeList.get(x)))
							{
								finalList.add(storeList.get(x));
							}
						}
					}
					searchCriteria.setLength(searchCriteria.length() - 2);
				}
				
				
				//Now that we have our final list then we need to sort through it and
				//match the number(magicNumber) of duplicate store numbers(if any) to the size of the masterlist.
				//This will give us our TRUE final SET of stores for our search criteria.
				
				TreeSet searchSet = new TreeSet();
				int magicNumber;
				
				for(int z = 0;z < finalList.size();z++)
				{
					magicNumber = 0;
					for(int y = 0; y < finalList.size();y++)
					{
						if(finalList.get(y).toString().equals(finalList.get(z).toString()))
						{
							magicNumber++;
							if(magicNumber == masterList.size())
							{
								searchSet.add(finalList.get(z));
							}
						}
					}
				}