java/sql-dk/src/info/globalcode/sql/dk/Functions.java
branchv_0
changeset 29 d66858b4b563
parent 16 5b8fcd35d4d6
child 33 04db6ccd6c48
equal deleted inserted replaced
28:57c44a6baedb 29:d66858b4b563
    15  * You should have received a copy of the GNU General Public License
    15  * You should have received a copy of the GNU General Public License
    16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    17  */
    17  */
    18 package info.globalcode.sql.dk;
    18 package info.globalcode.sql.dk;
    19 
    19 
       
    20 import info.globalcode.sql.dk.configuration.NameIdentified;
    20 import java.util.ArrayList;
    21 import java.util.ArrayList;
    21 import java.util.Collection;
    22 import java.util.Collection;
    22 import java.util.Map;
    23 import java.util.Map;
    23 
    24 
    24 /**
    25 /**
    82 			return new ArrayList<>();
    83 			return new ArrayList<>();
    83 		} else {
    84 		} else {
    84 			return c;
    85 			return c;
    85 		}
    86 		}
    86 	}
    87 	}
       
    88 
       
    89 	public static <T extends NameIdentified> T findByName(Collection<T> collection, String name) {
       
    90 		for (T element : collection) {
       
    91 			if (equalz(element.getName(), name)) {
       
    92 				return element;
       
    93 			}
       
    94 		}
       
    95 
       
    96 		return null;
       
    97 	}
    87 }
    98 }