Tabnine Logo
Objects.equal
Code IndexAdd Tabnine to your IDE (free)

How to use
equal
method
in
libcore.util.Objects

Best Java code snippets using libcore.util.Objects.equal (Showing top 20 results out of 315)

origin: robovm/robovm

@Override public final boolean equals(Object o) {
  if (!(o instanceof Entry)) {
    return false;
  }
  Entry<?, ?> e = (Entry<?, ?>) o;
  return Objects.equal(e.getKey(), key)
      && Objects.equal(e.getValue(), value);
}
origin: robovm/robovm

  /**
   * Returns true if {@code pattern} equals either "*" or {@code s}. Pattern
   * may be {@code null}.
   */
  private static boolean matchesNameOrWildcard(String pattern, String s) {
    return "*".equals(pattern) || Objects.equal(pattern, s);
  }
}
origin: robovm/robovm

/**
 * Returns true if {@code a} and {@code b} have the same protocol, host,
 * port, file, and reference.
 */
protected boolean equals(URL a, URL b) {
  return sameFile(a, b)
      && Objects.equal(a.getRef(), b.getRef())
      && Objects.equal(a.getQuery(), b.getQuery());
}
origin: robovm/robovm

/**
 * Returns true if this map contains the specified mapping.
 */
private boolean containsMapping(Object key, Object value) {
  if (key == null) {
    HashMapEntry<K, V> e = entryForNullKey;
    return e != null && Objects.equal(value, e.value);
  }
  int hash = secondaryHash(key);
  HashMapEntry<K, V>[] tab = table;
  int index = hash & (tab.length - 1);
  for (HashMapEntry<K, V> e = tab[index]; e != null; e = e.next) {
    if (e.hash == hash && key.equals(e.key)) {
      return Objects.equal(value, e.value);
    }
  }
  return false; // No entry for key
}
origin: robovm/robovm

private int indexOfAttributeNS(String namespaceURI, String localName) {
  for (int i = 0; i < attributes.size(); i++) {
    AttrImpl attr = attributes.get(i);
    if (Objects.equal(namespaceURI, attr.getNamespaceURI())
        && Objects.equal(localName, attr.getLocalName())) {
      return i;
    }
  }
  return -1;
}
origin: robovm/robovm

private int indexOfAttribute(String name) {
  for (int i = 0; i < attributes.size(); i++) {
    AttrImpl attr = attributes.get(i);
    if (Objects.equal(name, attr.getNodeName())) {
      return i;
    }
  }
  return -1;
}
origin: robovm/robovm

/**
 * Serialization helper method to maintain singletons and add any new
 * levels.
 *
 * @return the resolved instance.
 */
private Object readResolve() {
  synchronized (levels) {
    for (Level level : levels) {
      if (value != level.value) {
        continue;
      }
      if (!name.equals(level.name)) {
        continue;
      }
      if (Objects.equal(resourceBundleName, level.resourceBundleName)) {
        return level;
      }
    }
    // This is a new value, so add it.
    levels.add(this);
    return this;
  }
}
origin: robovm/robovm

@Override public boolean equals(Object other) {
  if (other instanceof CopyOnWriteArrayList) {
    return this == other
        || Arrays.equals(elements, ((CopyOnWriteArrayList<?>) other).elements);
  } else if (other instanceof List) {
    Object[] snapshot = elements;
    Iterator<?> i = ((List<?>) other).iterator();
    for (Object o : snapshot) {
      if (!i.hasNext() || !Objects.equal(o, i.next())) {
        return false;
      }
    }
    return !i.hasNext();
  } else {
    return false;
  }
}
origin: robovm/robovm

/**
 * Compares the specified object with this {@code Identity} for equality and
 * returns {@code true} if the specified object is equal, {@code false}
 * otherwise. {@code Identity} objects are considered equal, if they have
 * the same name and are in the same scope.
 *
 * @param obj
 *            object to be compared for equality with this {@code
 *            Identity}.
 * @return {@code true} if the specified object is equal to this {@code
 *         Identity}, otherwise {@code false}.
 */
@Override
public final boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (!(obj instanceof Identity)) {
    return false;
  }
  Identity i = (Identity) obj;
  if (Objects.equal(name, i.name) && (Objects.equal(scope, i.scope))) {
    return true;
  }
  return identityEquals(i);
}
origin: robovm/robovm

/**
 * Returns this map's entry that has the same key and value as {@code
 * entry}, or null if this map has no such entry.
 *
 * <p>This method uses the comparator for key equality rather than {@code
 * equals}. If this map's comparator isn't consistent with equals (such as
 * {@code String.CASE_INSENSITIVE_ORDER}), then {@code remove()} and {@code
 * contains()} will violate the collections API.
 */
Node<K, V> findByEntry(Entry<?, ?> entry) {
  Node<K, V> mine = findByObject(entry.getKey());
  boolean valuesEqual = mine != null && Objects.equal(mine.value, entry.getValue());
  return valuesEqual ? mine : null;
}
origin: robovm/robovm

/**
 * Returns the subscribers to be notified when {@code propertyName} changes.
 * This includes both listeners subscribed to all property changes and
 * listeners subscribed to the named property only.
 */
public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
  List<PropertyChangeListener> result = new ArrayList<PropertyChangeListener>();
  for (PropertyChangeListener p : listeners) {
    if (p instanceof PropertyChangeListenerProxy && Objects.equal(
        propertyName, ((PropertyChangeListenerProxy) p).getPropertyName())) {
      result.add(p);
    }
  }
  return result.toArray(new PropertyChangeListener[result.size()]);
}
origin: robovm/robovm

  /**
   * Returns true if {@code a} and {@code b} have the same protocol, host,
   * port and file.
   */
  protected boolean sameFile(URL a, URL b) {
    return Objects.equal(a.getProtocol(), b.getProtocol())
        && hostsEqual(a, b)
        && a.getEffectivePort() == b.getEffectivePort()
        && Objects.equal(a.getFile(), b.getFile());
  }
}
origin: robovm/robovm

/**
 * Returns true if {@code object} is a cookie with the same domain, name and
 * path. Domain and name use case-insensitive comparison; path uses a
 * case-sensitive comparison.
 */
@Override public boolean equals(Object object) {
  if (object == this) {
    return true;
  }
  if (object instanceof HttpCookie) {
    HttpCookie that = (HttpCookie) object;
    return name.equalsIgnoreCase(that.getName())
        && (domain != null ? domain.equalsIgnoreCase(that.domain) : that.domain == null)
        && Objects.equal(path, that.path);
  }
  return false;
}
origin: robovm/robovm

/**
 * Returns true if there are listeners registered to the property with the
 * given name.
 *
 * @param propertyName
 *            the name of the property
 * @return true if there are listeners registered to that property, false
 *         otherwise.
 */
public boolean hasListeners(String propertyName) {
  for (PropertyChangeListener p : listeners) {
    if (!(p instanceof PropertyChangeListenerProxy) || Objects.equal(
        propertyName, ((PropertyChangeListenerProxy) p).getPropertyName())) {
      return true;
    }
  }
  return false;
}
origin: robovm/robovm

  /**
   * Publishes a property change event to all listeners of that property. If
   * the event's old and new values are equal (but non-null), no event will be
   * published.
   */
  public void firePropertyChange(PropertyChangeEvent event) {
    String propertyName = event.getPropertyName();
    Object oldValue = event.getOldValue();
    Object newValue = event.getNewValue();
    if (newValue != null && oldValue != null && newValue.equals(oldValue)) {
      return;
    }

    notifyEachListener:
    for (PropertyChangeListener p : listeners) {
      // unwrap listener proxies until we get a mismatched name or the real listener
      while (p instanceof PropertyChangeListenerProxy) {
        PropertyChangeListenerProxy proxy = (PropertyChangeListenerProxy) p;
        if (!Objects.equal(proxy.getPropertyName(), propertyName)) {
          continue notifyEachListener;
        }
        p = (PropertyChangeListener) proxy.getListener();
      }
      p.propertyChange(event);
    }
  }
}
origin: robovm/robovm

if (key == null) {
  HashMapEntry<K, V> e = entryForNullKey;
  if (e == null || !Objects.equal(value, e.value)) {
    return false;
    e != null; prev = e, e = e.next) {
  if (e.hash == hash && key.equals(e.key)) {
    if (!Objects.equal(value, e.value)) {
      return false;  // Map has wrong value for key
origin: robovm/robovm

    a = aProxy.getListener();
  if (!Objects.equal(aName, bName)) {
    return false; // not equal; a and b subscribe to different properties
return aName == null && Objects.equal(a, b);
origin: robovm/robovm

@Override public void getSequenceLength(ASN1Sequence sequence) {
  ASN1Type[] type = sequence.type;
  Object[] values = new Object[type.length];
  int[] compLens = new int[type.length];
  sequence.getValues(content, values);
  push(compLens, values);
  int seqLen = 0;
  for (int i = 0; i < type.length; i++) {
    // check optional types
    if (values[i] == null) {
      if (sequence.OPTIONAL[i]) {
        continue;
      } else {
        throw new RuntimeException();//FIXME type & message
      }
    }
    if (Objects.equal(sequence.DEFAULT[i], values[i])) {
      values[i] = null;
      continue;
    }
    content = values[i];
    type[i].setEncodingContent(this);
    compLens[i] = length;
    // in case if we get content bytes while getting its length
    // FIXME what about remove it: need redesign
    values[i] = content;
    seqLen += type[i].getEncodedLength(this);
  }
  length = seqLen;
}
origin: ibinti/bugvm

/**
 * Returns true if {@code a} and {@code b} have the same protocol, host,
 * port, file, and reference.
 */
protected boolean equals(URL a, URL b) {
  return sameFile(a, b)
      && Objects.equal(a.getRef(), b.getRef())
      && Objects.equal(a.getQuery(), b.getQuery());
}
origin: MobiVM/robovm

private int indexOfAttributeNS(String namespaceURI, String localName) {
  for (int i = 0; i < attributes.size(); i++) {
    AttrImpl attr = attributes.get(i);
    if (Objects.equal(namespaceURI, attr.getNamespaceURI())
        && Objects.equal(localName, attr.getLocalName())) {
      return i;
    }
  }
  return -1;
}
libcore.utilObjectsequal

Javadoc

Returns true if two possibly-null objects are equal.

Popular methods of Objects

  • toString
    Returns a string reporting the value of each declared field, via reflection. Static and transient fi

Popular in Java

  • Finding current android device location
  • onCreateOptionsMenu (Activity)
  • getApplicationContext (Context)
  • setContentView (Activity)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now