/** * Check whether the given array contains the given element. * * @param array the array to check (may be <code>null</code>, * in which case the return value will always be <code>false</code>) * @param element the element to check for * @return whether the element has been found in the given array */ public static boolean containsElement(Object[] array, Object element) { if (array == null) { return false; } for (Object arrayEle : array) { if (nullSafeEquals(arrayEle, element)) { return true; } } return false; }
/** * Check whether the given Iterator contains the given element. * @param iterator the Iterator to check * @param element the element to look for * @return <code>true</code> if found, <code>false</code> else */ public static boolean contains(Iterator iterator, Object element) { if (iterator != null) { while (iterator.hasNext()) { Object candidate = iterator.next(); if (Objects.nullSafeEquals(candidate, element)) { return true; } } } return false; }
/** * Check whether the given Enumeration contains the given element. * @param enumeration the Enumeration to check * @param element the element to look for * @return <code>true</code> if found, <code>false</code> else */ public static boolean contains(Enumeration enumeration, Object element) { if (enumeration != null) { while (enumeration.hasMoreElements()) { Object candidate = enumeration.nextElement(); if (Objects.nullSafeEquals(candidate, element)) { return true; } } } return false; }
/** * Check whether the given array contains the given element. * * @param array the array to check (may be <code>null</code>, * in which case the return value will always be <code>false</code>) * @param element the element to check for * @return whether the element has been found in the given array */ public static boolean containsElement(Object[] array, Object element) { if (array == null) { return false; } for (Object arrayEle : array) { if (nullSafeEquals(arrayEle, element)) { return true; } } return false; }
/** * Check whether the given array contains the given element. * * @param array the array to check (may be <code>null</code>, * in which case the return value will always be <code>false</code>) * @param element the element to check for * @return whether the element has been found in the given array */ public static boolean containsElement(Object[] array, Object element) { if (array == null) { return false; } for (Object arrayEle : array) { if (nullSafeEquals(arrayEle, element)) { return true; } } return false; }
/** * Check whether the given Enumeration contains the given element. * @param enumeration the Enumeration to check * @param element the element to look for * @return <code>true</code> if found, <code>false</code> else */ public static boolean contains(Enumeration enumeration, Object element) { if (enumeration != null) { while (enumeration.hasMoreElements()) { Object candidate = enumeration.nextElement(); if (Objects.nullSafeEquals(candidate, element)) { return true; } } } return false; }
/** * Check whether the given Iterator contains the given element. * @param iterator the Iterator to check * @param element the element to look for * @return <code>true</code> if found, <code>false</code> else */ public static boolean contains(Iterator iterator, Object element) { if (iterator != null) { while (iterator.hasNext()) { Object candidate = iterator.next(); if (Objects.nullSafeEquals(candidate, element)) { return true; } } } return false; }
/** * Check whether the given Iterator contains the given element. * @param iterator the Iterator to check * @param element the element to look for * @return <code>true</code> if found, <code>false</code> else */ public static boolean contains(Iterator iterator, Object element) { if (iterator != null) { while (iterator.hasNext()) { Object candidate = iterator.next(); if (Objects.nullSafeEquals(candidate, element)) { return true; } } } return false; }
/** * Check whether the given Enumeration contains the given element. * @param enumeration the Enumeration to check * @param element the element to look for * @return <code>true</code> if found, <code>false</code> else */ public static boolean contains(Enumeration enumeration, Object element) { if (enumeration != null) { while (enumeration.hasMoreElements()) { Object candidate = enumeration.nextElement(); if (Objects.nullSafeEquals(candidate, element)) { return true; } } } return false; }
@Override public void setUtlStudent(Boolean newUtlStudent) { Boolean utlStudent = super.getUtlStudent(); if (getEvent() != null && !Objects.nullSafeEquals(utlStudent, newUtlStudent)) { throw new DomainException("Can't change this since an event is already created"); } super.setUtlStudent(newUtlStudent); }
@Override public void setUtlStudent(Boolean newUtlStudent) { Boolean utlStudent = super.getUtlStudent(); if (getEvent() != null && !Objects.nullSafeEquals(utlStudent, newUtlStudent)) { throw new DomainException("Can't change this since an event is already created"); } super.setUtlStudent(newUtlStudent); }
@Override public void setCandidacyInternal(Boolean newCandidacyInternal) { Boolean candidacyInternal = super.getCandidacyInternal(); if (getIndividualCandidacy()!= null && getIndividualCandidacy().getEvent() != null && !Objects.nullSafeEquals(candidacyInternal, newCandidacyInternal)) { throw new DomainException("Can't change this since an event is already created"); } super.setCandidacyInternal(newCandidacyInternal); }