for (Interest<InstanceInfo> basicInterest : getBasicInterests(newInterests)) { if (basicInterest instanceof InstanceInterest) { newInstances.add(((InstanceInterest) basicInterest).getPattern()); } else if (basicInterest instanceof ApplicationInterest) { newApplications.add(((ApplicationInterest) basicInterest).getPattern());