Skip to content

Instantly share code, notes, and snippets.

@Unh0lyTigg
Created September 21, 2014 21:16
Show Gist options
  • Save Unh0lyTigg/8a74b523e29e7b8ffaa5 to your computer and use it in GitHub Desktop.
Save Unh0lyTigg/8a74b523e29e7b8ffaa5 to your computer and use it in GitHub Desktop.
package org.utlauncher;
import java.util.List;
import org.utlauncher.data.Package;
import com.google.common.collect.Lists;
public enum PackageManager {
INSTANCE;
private List<Package> packs = Lists.newArrayList();
public static void initialize() {
}
public Package getPackageByName(String packname) {
return packs.stream().filter(p-> {return p.getPackageName().equals(packname);}).findFirst().orElse(null);
}
public Package getPackage(String packname) { // works the exact same way as getPackageByName(String) ....
for (Package p : packs)
if (p.getPackageName().equals(packname))
return p;
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment