org.restlet.util.Series.equals()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(84)

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

Series.equals介绍

[英]Tests the equality of two string, potentially null, which a case sensitivity flag.
[中]测试两个字符串的相等性,可能为null,这是区分大小写的标志。

代码示例

代码示例来源:origin: org.restlet/org.restlet

/**
 * Returns the first parameter found with the given name.
 * 
 * @param name
 *            The parameter name.
 * @param ignoreCase
 *            Indicates if the name comparison is case sensitive.
 * @return The first parameter found with the given name.
 */
public E getFirst(String name, boolean ignoreCase) {
  for (final E param : this) {
    if (equals(param.getName(), name, ignoreCase)) {
      return param;
    }
  }
  return null;
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Returns the first parameter found with the given name.
 * 
 * @param name
 *            The parameter name.
 * @param ignoreCase
 *            Indicates if the name comparison is case insensitive.
 * @return The first parameter found with the given name.
 */
public T getFirst(String name, boolean ignoreCase) {
  for (T param : this) {
    if (equals(param.getName(), name, ignoreCase)) {
      return param;
    }
  }
  return null;
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Returns the first parameter found with the given name.
 * 
 * @param name
 *            The parameter name.
 * @param ignoreCase
 *            Indicates if the name comparison is case insensitive.
 * @return The first parameter found with the given name.
 */
public T getFirst(String name, boolean ignoreCase) {
  for (T param : this) {
    if (equals(param.getName(), name, ignoreCase)) {
      return param;
    }
  }
  return null;
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Removes all the parameters with a given name.
 * 
 * @param name
 *            The parameter name.
 * @param ignoreCase
 *            Indicates if the name comparison is case sensitive.
 * @return True if the list changed.
 */
public boolean removeAll(String name, boolean ignoreCase) {
  boolean changed = false;
  Parameter param = null;
  for (final Iterator<E> iter = iterator(); iter.hasNext();) {
    param = iter.next();
    if (equals(param.getName(), name, ignoreCase)) {
      iter.remove();
      changed = true;
    }
  }
  return changed;
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Removes from this list the first entry whose name equals the specified
 * name ignoring the case or not.
 * 
 * @param name
 *            The name of the entries to be removed.
 * @param ignoreCase
 *            true if the comparison ignores the case, false otherwise.
 * @return false if no entry has been removed, true otherwise.
 */
public boolean removeFirst(String name, boolean ignoreCase) {
  boolean changed = false;
  Parameter param = null;
  for (final Iterator<E> iter = iterator(); iter.hasNext() && !changed;) {
    param = iter.next();
    if (equals(param.getName(), name, ignoreCase)) {
      iter.remove();
      changed = true;
    }
  }
  return changed;
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Removes all the parameters with a given name.
 * 
 * @param name
 *            The parameter name.
 * @param ignoreCase
 *            Indicates if the name comparison is case insensitive.
 * @return True if the list changed.
 */
public boolean removeAll(String name, boolean ignoreCase) {
  boolean changed = false;
  NamedValue<String> param = null;
  for (Iterator<T> iter = iterator(); iter.hasNext();) {
    param = iter.next();
    if (equals(param.getName(), name, ignoreCase)) {
      iter.remove();
      changed = true;
    }
  }
  return changed;
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Removes from this list the first entry whose name equals the specified
 * name ignoring the case or not.
 * 
 * @param name
 *            The name of the entries to be removed.
 * @param ignoreCase
 *            Indicates if the name comparison is case insensitive.
 * @return false if no entry has been removed, true otherwise.
 */
public boolean removeFirst(String name, boolean ignoreCase) {
  boolean changed = false;
  NamedValue<String> param = null;
  for (final Iterator<T> iter = iterator(); iter.hasNext() && !changed;) {
    param = iter.next();
    if (equals(param.getName(), name, ignoreCase)) {
      iter.remove();
      changed = true;
    }
  }
  return changed;
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Removes all the parameters with a given name.
 * 
 * @param name
 *            The parameter name.
 * @param ignoreCase
 *            Indicates if the name comparison is case insensitive.
 * @return True if the list changed.
 */
public boolean removeAll(String name, boolean ignoreCase) {
  boolean changed = false;
  NamedValue<String> param = null;
  for (Iterator<T> iter = iterator(); iter.hasNext();) {
    param = iter.next();
    if (equals(param.getName(), name, ignoreCase)) {
      iter.remove();
      changed = true;
    }
  }
  return changed;
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Removes from this list the first entry whose name equals the specified
 * name ignoring the case or not.
 * 
 * @param name
 *            The name of the entries to be removed.
 * @param ignoreCase
 *            Indicates if the name comparison is case insensitive.
 * @return false if no entry has been removed, true otherwise.
 */
public boolean removeFirst(String name, boolean ignoreCase) {
  boolean changed = false;
  NamedValue<String> param = null;
  for (final Iterator<T> iter = iterator(); iter.hasNext() && !changed;) {
    param = iter.next();
    if (equals(param.getName(), name, ignoreCase)) {
      iter.remove();
      changed = true;
    }
  }
  return changed;
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

param = iter.next();
if (equals(param.getName(), name, ignoreCase)) {
  if (found) {

代码示例来源:origin: org.restlet/org.restlet

/**
 * Returns a list of all the values associated to the parameter name.
 * 
 * @param name
 *            The parameter name.
 * @param ignoreCase
 *            Indicates if the name comparison is case sensitive.
 * @return The list of values.
 */
public Series<E> subList(String name, boolean ignoreCase) {
  final Series<E> result = createSeries(null);
  for (final E param : this) {
    if (equals(param.getName(), name, ignoreCase)) {
      result.add(param);
    }
  }
  return result;
}

代码示例来源:origin: org.restlet/org.restlet

param = iter.next();
if (equals(param.getName(), name, ignoreCase)) {
  if (found) {

代码示例来源:origin: org.restlet.osgi/org.restlet

/** {@inheritDoc} */
@Override
public boolean equals(final Object obj) {
  if (obj == this) {
    return true;
  }
  if (!(obj instanceof ChallengeRequest)) {
    return false;
  }
  final ChallengeRequest that = (ChallengeRequest) obj;
  return getParameters().equals(that.getParameters())
      && Objects.equals(getRealm(), that.getRealm())
      && Objects.equals(getScheme(), that.getScheme());
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Returns a list of all the values associated to the parameter name.
 * 
 * @param name
 *            The parameter name.
 * @param ignoreCase
 *            Indicates if the name comparison is case insensitive.
 * @return The list of values.
 */
public Series<T> subList(String name, boolean ignoreCase) {
  Series<T> result = new Series<T>(this.entryClass);
  for (T param : this) {
    if (equals(param.getName(), name, ignoreCase)) {
      result.add(param);
    }
  }
  return result;
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Returns a list of all the values associated to the parameter name.
 * 
 * @param name
 *            The parameter name.
 * @param ignoreCase
 *            Indicates if the name comparison is case insensitive.
 * @return The list of values.
 */
public Series<T> subList(String name, boolean ignoreCase) {
  Series<T> result = new Series<T>(this.entryClass);
  for (T param : this) {
    if (equals(param.getName(), name, ignoreCase)) {
      result.add(param);
    }
  }
  return result;
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Test the equality of two media types, with the possibility to ignore the
 * parameters.
 * 
 * @param obj
 *            The object to compare to.
 * @param ignoreParameters
 *            Indicates if parameters should be ignored during comparison.
 * @return True if both media types are equal.
 */
public boolean equals(Object obj, boolean ignoreParameters) {
  boolean result = (obj == this);
  // if obj == this no need to go further
  if (!result) {
    // if obj isn't a mediatype or is null don't evaluate further
    if (obj instanceof MediaType) {
      final MediaType that = (MediaType) obj;
      if (getMainType().equals(that.getMainType())
          && getSubType().equals(that.getSubType())) {
        result = ignoreParameters
            || getParameters().equals(that.getParameters());
      }
    }
  }
  return result;
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Test the equality of two media types, with the possibility to ignore the
 * parameters.
 * 
 * @param obj
 *            The object to compare to.
 * @param ignoreParameters
 *            Indicates if parameters should be ignored during comparison.
 * @return True if both media types are equal.
 */
public boolean equals(Object obj, boolean ignoreParameters) {
  boolean result = (obj == this);
  // if obj == this no need to go further
  if (!result) {
    // test for equality at Metadata level i.e. name and value.
    if (super.equals(obj)) {
      // if obj isn't a mediatype or is null don't evaluate further
      if (obj instanceof MediaType) {
        final MediaType that = (MediaType) obj;
        result = ignoreParameters
            || getParameters().equals(that.getParameters());
      }
    }
  }
  return result;
}

代码示例来源:origin: org.restlet.osgi/org.restlet

@Override
public boolean equals(Object obj) {
  if (obj == this) {
    return true;
  }
  if (!(obj instanceof ChallengeMessage)) {
    return false;
  }
  final ChallengeMessage that = (ChallengeMessage) obj;
  return getParameters().equals(that.getParameters())
      && Objects.equals(getRealm(), that.getRealm())
      && Objects.equals(getScheme(), that.getScheme())
      && Objects.equals(getServerNonce(), that.getServerNonce())
      && Objects.equals(getOpaque(), that.getOpaque())
      && Objects.equals(getDigestAlgorithm(), that.getDigestAlgorithm());
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Test the equality of two media types, with the possibility to ignore the
 * parameters.
 * 
 * @param obj
 *            The object to compare to.
 * @param ignoreParameters
 *            Indicates if parameters should be ignored during comparison.
 * @return True if both media types are equal.
 */
public boolean equals(Object obj, boolean ignoreParameters) {
  boolean result = (obj == this);
  // if obj == this no need to go further
  if (!result) {
    // if obj isn't a mediatype or is null don't evaluate further
    if (obj instanceof MediaType) {
      final MediaType that = (MediaType) obj;
      if (getMainType().equals(that.getMainType())
          && getSubType().equals(that.getSubType())) {
        result = ignoreParameters
            || getParameters().equals(that.getParameters());
      }
    }
  }
  return result;
}

代码示例来源:origin: org.restlet/org.restlet

/** {@inheritDoc} */
@Override
public final boolean equals(final Object obj) {
  boolean result = (obj == this);
  // if obj == this no need to go further
  if (!result) {
    // if obj isn't a challenge request or is null don't evaluate
    // further
    if (obj instanceof ChallengeRequest) {
      final ChallengeRequest that = (ChallengeRequest) obj;
      result = (getParameters().equals(that.getParameters()));
      if (result) {
        if (getRealm() != null) {
          result = getRealm().equals(that.getRealm());
        } else {
          result = (that.getRealm() == null);
        }
        if (result) {
          if (getScheme() != null) {
            result = getScheme().equals(that.getScheme());
          } else {
            result = (that.getScheme() == null);
          }
        }
      }
    }
  }
  return result;
}

相关文章