@Test public void if_set_nok() { assertFalse(ID.NONE.ifSet(String::valueOf).isPresent()); assertEquals("-", ID.NONE.ifSet(String::valueOf).orElse("-")); }
public <T> Optional<T> ifSet(Function<Integer, T> fn) { if (isSet()) { return Optional.ofNullable(fn.apply(value)); } else { return Optional.empty(); } }
ID implements Serializable { public <T> Optional<T> ifSet(Function<Integer, T> fn) { if (isSet()) { return Optional.ofNullable(fn.apply(value)); } else { return Optional.empty(); } } }
ID implements Serializable { public <T> Optional<T> ifSet(Function<Integer, T> fn) { if (isSet()) { return Optional.ofNullable(fn.apply(value)); } else { return Optional.empty(); } }  }
ID implements Serializable { public <T> Optional<T> ifSet(Function<Integer, T> fn) { if (isSet()) { return Optional.ofNullable(fn.apply(value)); } else { return Optional.empty(); } }  static ID of(int value); @Override String toString(); int get(); boolean isSet(); static boolean isDefined(ID id); Optional<T> ifSet(Function<Integer, T> fn); }
ID implements Serializable { public <T> Optional<T> ifSet(Function<Integer, T> fn) { if (isSet()) { return Optional.ofNullable(fn.apply(value)); } else { return Optional.empty(); } }  static ID of(int value); @Override String toString(); int get(); boolean isSet(); static boolean isDefined(ID id); Optional<T> ifSet(Function<Integer, T> fn); static ID NONE; }