Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ew, no no no. This will return the same thing every time, so this code should be moved to a static initialization block, where it caches the method names in a final String array.
- private static final computerMethodNames;
- static {
- computerMethodNames = new String[ComputerMethod.values().length];
- // fill in method names here, as you've done
- }
- Like that.
- #2
- I'm not super familiar with OpenComputers, so is there a good reason this doesn't return the same thing as CC's getType()? Is this a community naming convention at work?
- —
- #3
- BigRenegade/BigReactors
- Linear-time lookup is ugly, but the Array conversion is much worse. Place the java.util.Arrays.asList() call into a static initializer and cache the results in a static final variable, please.
- —
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement