fork(1) download
  1. public final class Main {
  2.  
  3. public static void main (String[] args) {
  4. var yellow = Color.findByName("YELLOW");
  5. var rgb = yellow.getRgb();
  6. // Needs to check whether or not 'rgb' is -1 after all.
  7. }
  8.  
  9. public interface Color {
  10.  
  11. /** Represents the invalid color. */
  12. static final Color INVALID = () -> -1;
  13.  
  14. /**
  15. Returns the Color instance that matches with the specified name.
  16.  
  17.   @param name
  18.   ...
  19.   @return
  20. {@code null} if nothing matches with {@code name}.
  21. Otherwise, the instance that matches.
  22.   */
  23. static Color findByName(String name) {
  24. return INVALID;
  25. }
  26.  
  27. /**
  28. Returns the 24-bit integer value representing RGB.
  29.  
  30.   @return
  31.   -1 if this object is invalid.
  32.   Otherwise, the 24-bit integer value representing RGB.
  33.   */
  34. int getRgb();
  35. }
  36. }
  37.  
Success #stdin #stdout 0.07s 33376KB
stdin
Standard input is empty
stdout
Standard output is empty