public static Interest<InstanceInfo> forApplications(Operator operator, String... applicationNames) { if (applicationNames.length == 0) { return EmptyRegistryInterest.getInstance(); } if (applicationNames.length == 1) { return new ApplicationInterest(applicationNames[0], operator); } Interest[] interests = new Interest[applicationNames.length]; for (int i = 0; i < interests.length; i++) { interests[i] = new ApplicationInterest(applicationNames[i], operator); } return new MultipleInterests<InstanceInfo>(interests); }