Java examples for Object Oriented Design:Method Parameter
Convenience method of choosing the first non-null value starting from the left
//package com.java2s; public class Main { /**//from w ww.j a va 2 s .c o m * Convenience method of choosing the first non-null value starting from the left * * @param a * @param b * @return */ @SafeVarargs public static <T> T Coalice(T... values) { for (T item : values) { if (item != null) { return item; } } return null; } }