java.util.ArrayList.equals()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(341)

本文整理了Java中java.util.ArrayList.equals()方法的一些代码示例,展示了ArrayList.equals()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArrayList.equals()方法的具体详情如下:
包路径:java.util.ArrayList
类名称:ArrayList
方法名:equals

ArrayList.equals介绍

[英]Compares the specified object with this list for equality.
[中]比较指定对象与此列表是否相等。

代码示例

代码示例来源:origin: ReactiveX/RxJava

@Override
public boolean equals(Object obj) {
  if (obj instanceof VolatileSizeArrayList) {
    return list.equals(((VolatileSizeArrayList<?>)obj).list);
  }
  return list.equals(obj);
}

代码示例来源:origin: redisson/redisson

@Override
public boolean equals(Object obj) {
  if (obj instanceof VolatileSizeArrayList) {
    return list.equals(((VolatileSizeArrayList<?>)obj).list);
  }
  return list.equals(obj);
}

代码示例来源:origin: Alluxio/alluxio

@Override
public boolean equals(Object o) {
 if (this == o) {
  return true;
 }
 if (!(o instanceof BlockInfo)) {
  return false;
 }
 BlockInfo that = (BlockInfo) o;
 return mBlockId == that.mBlockId && mLength == that.mLength
   && mLocations.equals(that.mLocations);
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
public boolean equals(Object o) {
 if (this == o) return true;
 if (o == null || getClass() != o.getClass()) return false;
 PemTrustOptions that = (PemTrustOptions) o;
 if (!certPaths.equals(that.certPaths)) return false;
 return certValues.equals(that.certValues);
}

代码示例来源:origin: Sable/soot

/**
 * {@inheritDoc}
 */
public boolean equals(Object obj) {
 return worklist.equals(obj);
}

代码示例来源:origin: spotbugs/spotbugs

@Override
@ExpectWarning("BC")
public boolean equals(Object o) {
  return lst.equals(((BadDowncastOfToArray) o).lst);
}

代码示例来源:origin: mttkay/ignition

/**
 * @see java.lang.Object#equals(java.lang.Object)
 */
@Override
public synchronized boolean equals(Object o) {
  if (!(o instanceof CachedList)) {
    return false;
  }
  @SuppressWarnings("rawtypes")
  CachedList that = (CachedList) o;
  return clazz.equals(that.clazz) && list.equals(that.list);
}

代码示例来源:origin: wildfly/wildfly

public boolean equals(final SimpleName simpleName) {
  return simpleName != null && simpleName.getClass() == getClass() && segments.equals(simpleName.segments);
}

代码示例来源:origin: spotbugs/spotbugs

@Override
public boolean equals(Object obj) {
  if (obj == null || obj.getClass() != this.getClass()) {
    return false;
  }
  CallList other = (CallList) obj;
  return this.callList.equals(other.callList);
}

代码示例来源:origin: Alluxio/alluxio

@Override
public boolean equals(Object o) {
 if (this == o) {
  return true;
 }
 if (!(o instanceof FileBlockInfo)) {
  return false;
 }
 FileBlockInfo that = (FileBlockInfo) o;
 return mBlockInfo.equals(that.mBlockInfo) && mOffset == that.mOffset
   && mUfsLocations.equals(that.mUfsLocations);
}

代码示例来源:origin: apache/hbase

@Override
public boolean equals(Object obj) {
 if (!(obj instanceof FilterListWithAND)) {
  return false;
 }
 if (this == obj) {
  return true;
 }
 FilterListWithAND f = (FilterListWithAND) obj;
 return this.filters.equals(f.getFilters()) && this.seekHintFilters.equals(f.seekHintFilters);
}

代码示例来源:origin: apache/hive

@Override
public boolean equals(Object obj) {
 if (obj == null || !(obj instanceof OpTreeSignature)) {
  return false;
 }
 if (obj == this) {
  return true;
 }
 OpTreeSignature o = (OpTreeSignature) obj;
 return sig.equals(o.sig) && parentSig.equals(o.parentSig);
}

代码示例来源:origin: apache/hbase

@Override
public boolean equals(Object obj) {
 if (obj == null || (!(obj instanceof FilterListWithOR))) {
  return false;
 }
 if (this == obj) {
  return true;
 }
 FilterListWithOR f = (FilterListWithOR) obj;
 return this.filters.equals(f.getFilters()) &&
  this.prevFilterRCList.equals(f.prevFilterRCList) &&
  this.prevCellList.equals(f.prevCellList);
}

代码示例来源:origin: apache/hive

@Override
public boolean equals(Object obj) {
 if (obj == null) {
  return false;
 }
 InputSignature other = null;
 try {
  other = (InputSignature) obj;
 } catch (ClassCastException cce) {
  return false;
 }
 return name.equalsIgnoreCase(other.getName())
   && (other.typeArray.equals(typeArray));
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
public boolean equals(Object o) {
 if (this == o) return true;
 if (!(o instanceof TCPSSLOptions)) return false;
 if (!super.equals(o)) return false;
 TCPSSLOptions that = (TCPSSLOptions) o;
 if (idleTimeout != that.idleTimeout) return false;
 if (idleTimeoutUnit != null ? !idleTimeoutUnit.equals(that.idleTimeoutUnit) : that.idleTimeoutUnit != null) return false;
 if (soLinger != that.soLinger) return false;
 if (ssl != that.ssl) return false;
 if (tcpKeepAlive != that.tcpKeepAlive) return false;
 if (tcpNoDelay != that.tcpNoDelay) return false;
 if (tcpFastOpen != that.tcpFastOpen) return false;
 if (tcpQuickAck != that.tcpQuickAck) return false;
 if (tcpCork != that.tcpCork) return false;
 if (usePooledBuffers != that.usePooledBuffers) return false;
 if (crlPaths != null ? !crlPaths.equals(that.crlPaths) : that.crlPaths != null) return false;
 if (crlValues != null ? !crlValues.equals(that.crlValues) : that.crlValues != null) return false;
 if (enabledCipherSuites != null ? !enabledCipherSuites.equals(that.enabledCipherSuites) : that.enabledCipherSuites != null)
  return false;
 if (keyCertOptions != null ? !keyCertOptions.equals(that.keyCertOptions) : that.keyCertOptions != null) return false;
 if (trustOptions != null ? !trustOptions.equals(that.trustOptions) : that.trustOptions != null) return false;
 if (useAlpn != that.useAlpn) return false;
 if (sslEngineOptions != null ? !sslEngineOptions.equals(that.sslEngineOptions) : that.sslEngineOptions != null) return false;
 if (!enabledSecureTransportProtocols.equals(that.enabledSecureTransportProtocols)) return false;
 return true;
}

代码示例来源:origin: spotbugs/spotbugs

public static void falsePositive() {
    ArrayList<Integer> aLst = new ArrayList<Integer>();
    LinkedList<Integer> lLst = new LinkedList<Integer>();
    MyList<Integer> mLst = new MyList<Integer>();

    Set<ArrayList<Integer>> alSet = new HashSet<ArrayList<Integer>>();
    Set<LinkedList<Integer>> llSet = new HashSet<LinkedList<Integer>>();

    System.out.println(aLst.equals(lLst));
    System.out.println(mLst.equals(lLst));

    alSet.contains(lLst);
    alSet.contains(mLst);
    alSet.containsAll(llSet);

  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public void writeFloatBufferArrayList(ArrayList<FloatBuffer> array, String name, ArrayList<FloatBuffer> defVal) throws IOException {
  if (array == null) {
    return;
  }
  if (array.equals(defVal)) {
    return;
  }
  Element el = appendElement(name);
  el.setAttribute(XMLExporter.ATTRIBUTE_SIZE, String.valueOf(array.size()));
  for (FloatBuffer o : array) {
    write(o, XMLExporter.ELEMENT_FLOATBUFFER, null);
  }
  currentElement = (Element) el.getParentNode();
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  InnerType innerType = (InnerType) o;
  if (innerLongCol != null ? !innerLongCol.equals(innerType.innerLongCol) : innerType.innerLongCol != null)
    return false;
  if (innerStrCol != null ? !innerStrCol.equals(innerType.innerStrCol) : innerType.innerStrCol != null)
    return false;
  return arrListCol != null ? arrListCol.equals(innerType.arrListCol) : innerType.arrListCol == null;
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
  @Override public boolean equals(Object other) {
    if (this == other)
      return true;
    if (other == null || getClass() != other.getClass())
      return false;
    TestObject obj = (TestObject)other;
    assert this == selfRef;
    assert obj == obj.selfRef;
    return boolVal == obj.boolVal && intVal == obj.intVal && longVal == obj.longVal &&
      Arrays.equals(dblArr, obj.dblArr) && Arrays.equals(longArr, obj.longArr) &&
      list.equals(obj.list) && map.equals(obj.map);
  }
}

代码示例来源:origin: apache/storm

private void checkCollectorOutput_seq(MockCollector collector, Path... seqFiles) throws IOException {
  ArrayList<String> expected = new ArrayList<>();
  for (Path seqFile : seqFiles) {
    List<String> lines = getSeqFileContents(fs, seqFile);
    expected.addAll(lines);
  }
  Assert.assertTrue(expected.equals(collector.lines));
}

相关文章