java.text.DateFormat.equals()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.8k)|赞(0)|评价(0)|浏览(238)

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

DateFormat.equals介绍

[英]Compares this date format with the specified object and indicates if they are equal.
[中]将此日期格式与指定对象进行比较,并指示它们是否相等。

代码示例

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

/** provoke hits */
public void testDateFormats() {
  // test 1
  DateFormat tFrm1 = frmStatic; // should fire
  if (tFrm1.equals(frmStatic)) // hide from unused variable detector;
                 // should fire
    System.out.println("Frm1 equals frmStatic");
  // test 2
  DateFormat tFrm2 = getFrm();
  if (System.currentTimeMillis() < 1L)
    return; // some other code in between
  if (tFrm2.equals(frmStatic))
    return; // should fire
  // test 3
  DateFormat tCal3 = frmInstance;
  tCal3.setLenient(true); // should not fire
  // test 4
  DateFormat tCal4 = frmStatic2; // should fire
  int tInt = 1; // some other code in between
  boolean tBoolean = false; // some other code in between
  Object tObj = new Object(); // some other code in between
  if (tObj.hashCode() > 0)
    return; // some other code in between
  tCal4.setLenient(true); // should fire
  tCal4 = new SimpleDateFormat();
  tCal4.setLenient(true); // should not fire
}

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

/**
 * Compares the specified object with this simple date format and indicates
 * if they are equal. In order to be equal, {@code object} must be an
 * instance of {@code SimpleDateFormat} and have the same {@code DateFormat}
 * properties, pattern, {@code DateFormatSymbols} and creation year.
 *
 * @param object
 *            the object to compare with this object.
 * @return {@code true} if the specified object is equal to this simple date
 *         format; {@code false} otherwise.
 * @see #hashCode
 */
@Override
public boolean equals(Object object) {
  if (this == object) {
    return true;
  }
  if (!(object instanceof SimpleDateFormat)) {
    return false;
  }
  SimpleDateFormat simple = (SimpleDateFormat) object;
  return super.equals(object) && pattern.equals(simple.pattern)
      && formatData.equals(simple.formatData);
}

代码示例来源:origin: json-iterator/java

@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  if (!super.equals(o)) return false;
  Builder builder = (Builder) o;
  return excludeFieldsWithoutExposeAnnotation == builder.excludeFieldsWithoutExposeAnnotation &&
      disableHtmlEscaping == builder.disableHtmlEscaping &&
      dateFormat.get().equals(builder.dateFormat.get()) &&
      (fieldNamingStrategy != null ? fieldNamingStrategy.equals(builder.fieldNamingStrategy) :
          builder.fieldNamingStrategy == null) &&
      (version != null ? version.equals(builder.version) : builder.version == null) &&
      (serializationExclusionStrategies != null ?
          serializationExclusionStrategies.equals(builder.serializationExclusionStrategies) :
          builder.serializationExclusionStrategies == null) &&
      (deserializationExclusionStrategies != null ?
          deserializationExclusionStrategies.equals(builder.deserializationExclusionStrategies) :
          builder.deserializationExclusionStrategies == null);
}

代码示例来源:origin: at.bestsolution.eclipse/com.ibm.icu.base

/**
 * Overrides equals.
 * @stable ICU 2.0
 */
public boolean equals(Object obj) {
  try {
    return dateFormat.equals(((DateFormat)obj).dateFormat);
  }
  catch (Exception e) {
    return false;
  }
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.ibm.icu.base

/**
 * Overrides equals.
 * @stable ICU 2.0
 */
public boolean equals(Object obj) {
  try {
    return dateFormat.equals(((DateFormat)obj).dateFormat);
  }
  catch (Exception e) {
    return false;
  }
}

代码示例来源:origin: org.mnode.ical4j/ical4j

public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  if (!super.equals(o)) {
    return false;
  }
  final CalendarDateFormat that = (CalendarDateFormat) o;
  return lenient == that.lenient && pattern.equals(that.pattern) && timeZone.equals(that.timeZone);
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-chart

/**
 * Tests this formatter for equality with an arbitrary object.
 *
 * @param obj  the object (<code>null</code> permitted).
 *
 * @return A boolean.
 */
public boolean equals(Object obj) {
  if (obj == this) {
    return true;
  }
  if (!(obj instanceof QuarterDateFormat)) {
    return false;
  }
  QuarterDateFormat that = (QuarterDateFormat) obj;
  if (!Arrays.equals(this.quarters, that.quarters)) {
    return false;
  }
  if (this.quarterFirst != that.quarterFirst) {
    return false;
  }
  return super.equals(obj);
}

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

public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  if (!super.equals(o)) {
    return false;
  }
  final CalendarDateFormat that = (CalendarDateFormat) o;
  return lenient == that.lenient && pattern.equals(that.pattern) && timeZone.equals(that.timeZone);
}

代码示例来源:origin: net.oneandone.ical4j/ical4j

public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  if (!super.equals(o)) {
    return false;
  }
  final CalendarDateFormat that = (CalendarDateFormat) o;
  return lenient == that.lenient && pattern.equals(that.pattern) && timeZone.equals(that.timeZone);
}

代码示例来源:origin: org.bedework.ical4j/ical4j

public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  if (!super.equals(o)) {
    return false;
  }
  final CalendarDateFormat that = (CalendarDateFormat) o;
  return lenient == that.lenient && pattern.equals(that.pattern) && timeZone.equals(that.timeZone);
}

代码示例来源:origin: org.bedework/bw-ical4j-cl

public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  if (!super.equals(o)) {
    return false;
  }
  final CalendarDateFormat that = (CalendarDateFormat) o;
  if (lenient != that.lenient) {
    return false;
  }
  if (!pattern.equals(that.pattern)) {
    return false;
  }
  if (!timeZone.equals(that.timeZone)) {
    return false;
  }
  return true;
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * Compares the given object with this <code>SimpleDateFormat</code> for
 * equality.
 *
 * @return true if the given object is equal to this
 * <code>SimpleDateFormat</code>
 */
public boolean equals(Object obj)
{
  if (!super.equals(obj)) return false; // super does class check
  SimpleDateFormat that = (SimpleDateFormat) obj;
  return (pattern.equals(that.pattern)
      && formatData.equals(that.formatData));
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * Compares the given object with this <code>SimpleDateFormat</code> for
 * equality.
 *
 * @return true if the given object is equal to this
 * <code>SimpleDateFormat</code>
 */
public boolean equals(Object obj)
{
  if (!super.equals(obj)) return false; // super does class check
  SimpleDateFormat that = (SimpleDateFormat) obj;
  return (pattern.equals(that.pattern)
      && formatData.equals(that.formatData));
}

代码示例来源:origin: com.jsoniter/jsoniter

@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  if (!super.equals(o)) return false;
  Builder builder = (Builder) o;
  return excludeFieldsWithoutExposeAnnotation == builder.excludeFieldsWithoutExposeAnnotation &&
      disableHtmlEscaping == builder.disableHtmlEscaping &&
      dateFormat.get().equals(builder.dateFormat.get()) &&
      (fieldNamingStrategy != null ? fieldNamingStrategy.equals(builder.fieldNamingStrategy) :
          builder.fieldNamingStrategy == null) &&
      (version != null ? version.equals(builder.version) : builder.version == null) &&
      (serializationExclusionStrategies != null ?
          serializationExclusionStrategies.equals(builder.serializationExclusionStrategies) :
          builder.serializationExclusionStrategies == null) &&
      (deserializationExclusionStrategies != null ?
          deserializationExclusionStrategies.equals(builder.deserializationExclusionStrategies) :
          builder.deserializationExclusionStrategies == null);
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Compares the specified object with this simple date format and indicates
 * if they are equal. In order to be equal, {@code object} must be an
 * instance of {@code SimpleDateFormat} and have the same {@code DateFormat}
 * properties, pattern, {@code DateFormatSymbols} and creation year.
 *
 * @param object
 *            the object to compare with this object.
 * @return {@code true} if the specified object is equal to this simple date
 *         format; {@code false} otherwise.
 * @see #hashCode
 */
@Override
public boolean equals(Object object) {
  if (this == object) {
    return true;
  }
  if (!(object instanceof SimpleDateFormat)) {
    return false;
  }
  SimpleDateFormat simple = (SimpleDateFormat) object;
  return super.equals(object) && pattern.equals(simple.pattern)
      && formatData.equals(simple.formatData);
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Compares the specified object with this simple date format and indicates
 * if they are equal. In order to be equal, {@code object} must be an
 * instance of {@code SimpleDateFormat} and have the same {@code DateFormat}
 * properties, pattern, {@code DateFormatSymbols} and creation year.
 *
 * @param object
 *            the object to compare with this object.
 * @return {@code true} if the specified object is equal to this simple date
 *         format; {@code false} otherwise.
 * @see #hashCode
 */
@Override
public boolean equals(Object object) {
  if (this == object) {
    return true;
  }
  if (!(object instanceof SimpleDateFormat)) {
    return false;
  }
  SimpleDateFormat simple = (SimpleDateFormat) object;
  return super.equals(object) && pattern.equals(simple.pattern)
      && formatData.equals(simple.formatData);
}

代码示例来源:origin: MobiVM/robovm

/**
 * Compares the specified object with this simple date format and indicates
 * if they are equal. In order to be equal, {@code object} must be an
 * instance of {@code SimpleDateFormat} and have the same {@code DateFormat}
 * properties, pattern, {@code DateFormatSymbols} and creation year.
 *
 * @param object
 *            the object to compare with this object.
 * @return {@code true} if the specified object is equal to this simple date
 *         format; {@code false} otherwise.
 * @see #hashCode
 */
@Override
public boolean equals(Object object) {
  if (this == object) {
    return true;
  }
  if (!(object instanceof SimpleDateFormat)) {
    return false;
  }
  SimpleDateFormat simple = (SimpleDateFormat) object;
  return super.equals(object) && pattern.equals(simple.pattern)
      && formatData.equals(simple.formatData);
}

代码示例来源:origin: com.coherentlogic.quandl.client/quandl-client-core

@Override
public boolean equals(Object obj) {
  if (this == obj)
    return true;
  if (!super.equals(obj))
    return false;
  if (getClass() != obj.getClass())
    return false;
  Row other = (Row) obj;
  if (columnMap == null) {
    if (other.columnMap != null)
      return false;
  } else if (!columnMap.equals(other.columnMap))
    return false;
  if (dateFormat == null) {
    if (other.dateFormat != null)
      return false;
  } else if (!dateFormat.equals(other.dateFormat))
    return false;
  return true;
}

代码示例来源:origin: EvoSuite/evosuite

public boolean equals(Object obj) {
  Capturer.capture(Instrumenter.CAPTURE_ID_JAVA_TEXT_DATEFORMAT, this, "equals", "(Ljava/lang/Object;)Z", new Object[] {obj});
  boolean ret = super.equals(obj);
  Capturer.enable(Instrumenter.CAPTURE_ID_JAVA_TEXT_DATEFORMAT, this, ret);
  return ret;
}

代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-tool-lib

public static String getDateWidget(String fieldId, String name) {
 String calType = "2"; // default to US
 DateWidgetFormat format = new DateWidgetFormat();
 if (format.getLocaleDateFormat().equals(DateWidgetFormat.DD_MM_YYYY())) {
   calType = "1"; // European type
 }
 String javascript = "javascript:var cal"+fieldId+" = new calendar"+calType+
   "(document.getElementById('"+name+"'));cal"+fieldId+".year_scroll = true;cal"+fieldId+
   ".time_comp = false;cal"+fieldId+".popup('','/jsf-resource/inputDate/')";
 return javascript;
}

相关文章