@Test public void testFirstNotNull() { final Integer nullInteger = null; final Integer notNullInteger = 1; assertThat(Alternatives.firstNotNull(notNullInteger, nullInteger), is(notNullInteger)); assertThat(Alternatives.firstNotNull(nullInteger, notNullInteger), is(notNullInteger)); assertThat(Alternatives.firstNotNull(nullInteger, nullInteger), is(nullValue())); }
public static <T> T firstNotNull(final T... objects) { for (final T object : objects) { if (object != null) { return object; } } return null; }
Alternatives { public static <T> T firstNotNull(final T... objects) { for (final T object : objects) { if (object != null) { return object; } } return null; } }
Alternatives { public static <T> T firstNotNull(final T... objects) { for (final T object : objects) { if (object != null) { return object; } } return null; } private  Alternatives(); }
Alternatives { public static <T> T firstNotNull(final T... objects) { for (final T object : objects) { if (object != null) { return object; } } return null; } private  Alternatives(); static T firstNotNull(final T... objects); }
Alternatives { public static <T> T firstNotNull(final T... objects) { for (final T object : objects) { if (object != null) { return object; } } return null; } private  Alternatives(); static T firstNotNull(final T... objects);  }