Example usage for java.util Objects equals

List of usage examples for java.util Objects equals

Introduction

In this page you can find the example usage for java.util Objects equals.

Prototype

public static boolean equals(Object a, Object b) 

Source Link

Document

Returns true if the arguments are equal to each other and false otherwise.

Usage

From source file:com.synclab.neo4j.client.response.GraphNode.java

@Override
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }/*from w w  w .jav  a 2s  .  co m*/
    if (getClass() != obj.getClass()) {
        return false;
    }
    final GraphNode other = (GraphNode) obj;
    if (!Objects.equals(this.id, other.id)) {
        return false;
    }
    return true;
}

From source file:com.swcguild.dvdlibrarymvc.model.Dvd.java

@Override
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }/* ww  w . ja v a  2 s  .  co  m*/
    if (getClass() != obj.getClass()) {
        return false;
    }
    final Dvd other = (Dvd) obj;
    if (!Objects.equals(this.title, other.title)) {
        return false;
    }
    if (!Objects.equals(this.releaseDate, other.releaseDate)) {
        return false;
    }
    if (!Objects.equals(this.mpaaRating, other.mpaaRating)) {
        return false;
    }
    if (!Objects.equals(this.directorName, other.directorName)) {
        return false;
    }
    if (!Objects.equals(this.studio, other.studio)) {
        return false;
    }
    if (!Objects.equals(this.id, other.id)) {
        return false;
    }
    if (!Objects.equals(this.userNote, other.userNote)) {
        return false;
    }
    return true;
}

From source file:th.co.geniustree.dental.model.Bill.java

@Override
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }/*from w w  w  . j a v  a  2  s  .com*/
    if (getClass() != obj.getClass()) {
        return false;
    }
    final Bill other = (Bill) obj;
    if (!Objects.equals(this.id, other.id)) {
        return false;
    }
    return true;
}

From source file:com.autodesk.client.model.Refs.java

@Override
public boolean equals(java.lang.Object o) {
    if (this == o) {
        return true;
    }//from  ww w  .j  a  va2  s .  c  o m
    if (o == null || getClass() != o.getClass()) {
        return false;
    }
    Refs refs = (Refs) o;
    return Objects.equals(this.jsonapi, refs.jsonapi) && Objects.equals(this.data, refs.data);
}

From source file:com.autodesk.client.model.CreateStorage.java

@Override
public boolean equals(java.lang.Object o) {
    if (this == o) {
        return true;
    }//from   www . ja va  2  s.c o m
    if (o == null || getClass() != o.getClass()) {
        return false;
    }
    CreateStorage createStorage = (CreateStorage) o;
    return Objects.equals(this.jsonapi, createStorage.jsonapi) && Objects.equals(this.data, createStorage.data);
}

From source file:com.autodesk.client.model.CreateVersion.java

@Override
public boolean equals(java.lang.Object o) {
    if (this == o) {
        return true;
    }//from  w  w  w  .ja v a2  s.c om
    if (o == null || getClass() != o.getClass()) {
        return false;
    }
    CreateVersion createVersion = (CreateVersion) o;
    return Objects.equals(this.jsonapi, createVersion.jsonapi) && Objects.equals(this.data, createVersion.data);
}

From source file:uk.ac.ebi.ep.data.search.model.Taxonomy.java

@Override
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }/*from w  w w  .  j ava2s .com*/
    if (getClass() != obj.getClass()) {
        return false;
    }
    final Taxonomy other = (Taxonomy) obj;
    if (!Objects.equals(this.taxId, other.taxId)) {
        return false;
    }
    return true;
}

From source file:com.linksinnovation.elearning.model.Wishlist.java

@Override
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }//from ww  w.j a v  a 2 s  .c o m
    if (getClass() != obj.getClass()) {
        return false;
    }
    final Wishlist other = (Wishlist) obj;
    if (!Objects.equals(this.id, other.id)) {
        return false;
    }
    return true;
}

From source file:Main.java

/** Return the index of {@code needle} in the {@code array}, or else {@code -1} */
public static <T> int getArrayIndex(T[] array, T needle) {
    if (array == null) {
        return -1;
    }/*from   w w  w  .java2  s.  c  o  m*/

    int index = 0;
    for (T elem : array) {
        if (Objects.equals(elem, needle)) {
            return index;
        }
        index++;
    }

    return -1;
}

From source file:net.dv8tion.jda.client.handle.CallUpdateHandler.java

@Override
protected Long handleInternally(JSONObject content) {
    final long channelId = content.getLong("channel_id");
    JSONArray ringing = content.getJSONArray("ringing");
    Region region = Region.fromKey(content.getString("region"));

    CallableChannel channel = api.asClient().getGroupById(channelId);
    if (channel == null)
        channel = api.getPrivateChannelMap().get(channelId);
    if (channel == null) {
        api.getEventCache().cache(EventCache.Type.CHANNEL, channelId, () -> handle(responseNumber, allContent));
        EventCache.LOG/*w  w  w . j  a  v a 2 s  .c o  m*/
                .debug("Received a CALL_UPDATE for a Group/PrivateChannel that has not yet been cached. JSON: "
                        + content);
        return null;
    }

    CallImpl call = (CallImpl) channel.getCurrentCall();
    if (call == null) {
        api.getEventCache().cache(EventCache.Type.CALL, channelId, () -> handle(responseNumber, allContent));
        EventCache.LOG
                .debug("Received a CALL_UPDATE for a Call that has not yet been cached. JSON: " + content);
        return null;
    }

    if (!Objects.equals(region, call.getRegion())) {
        Region oldRegion = call.getRegion();
        call.setRegion(region);
        api.getEventManager().handle(new CallUpdateRegionEvent(api, responseNumber, call, oldRegion));
    }

    //Deal with CallUser ringing status changes
    if (ringing.length() > 0) {
        List<Long> givenRingingIds = toLongList(ringing);
        List<CallUser> stoppedRingingUsers = new ArrayList<>();
        List<CallUser> startedRingingUsers = new ArrayList<>();

        for (CallUser cUser : call.getRingingUsers()) {
            final long userId = cUser.getUser().getIdLong();

            //If the ringing user is no longer ringing, change the ringing status
            if (!givenRingingIds.contains(userId)) {
                ((CallUserImpl) cUser).setRinging(false);
                stoppedRingingUsers.add(cUser);
            } else {
                givenRingingIds.remove(userId);
            }
        }

        //Any Ids that are users that have started ringing, so we need to set their ringing status as such
        for (long userId : givenRingingIds) {
            CallUserImpl cUser = (CallUserImpl) call.getCallUserMap().get(userId);
            cUser.setRinging(true);
            startedRingingUsers.add(cUser);
        }

        if (stoppedRingingUsers.size() > 0 || startedRingingUsers.size() > 0) {
            api.getEventManager().handle(new CallUpdateRingingUsersEvent(api, responseNumber, call,
                    stoppedRingingUsers, startedRingingUsers));
        }
    }
    return null;
}