org.eclipse.jdt.internal.core.util.Util.sortCopy()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(13.9k)|赞(0)|评价(0)|浏览(147)

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

Util.sortCopy介绍

[英]Sorts an array of Strings, returning a new array with the sorted items. The original array is left untouched.
[中]对字符串数组进行排序,返回一个包含已排序项的新数组。原始数组保持不变。

代码示例

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Compares two String arrays using equals() on the elements.
 * The arrays are first sorted.
 * Either or both arrays may be null.
 * Returns true if both are null.
 * Returns false if only one is null.
 * If both are arrays, returns true iff they have the same length and
 * iff, after sorting both arrays, all elements compare true with equals.
 * The original arrays are left untouched.
 */
public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
  if (a == b)	return true;
  if (a == null || b == null) return false;
  int len = a.length;
  if (len != b.length) return false;
  if (len >= 2) {  // only need to sort if more than two items
    a = sortCopy(a);
    b = sortCopy(b);
  }
  for (int i = 0; i < len; ++i) {
    if (!a[i].equals(b[i])) return false;
  }
  return true;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

/**
 * Compares two arrays using equals() on the elements.
 * The arrays are first sorted.
 * Either or both arrays may be null.
 * Returns true if both are null.
 * Returns false if only one is null.
 * If both are arrays, returns true iff they have the same length and
 * iff, after sorting both arrays, all elements compare true with equals.
 * The original arrays are left untouched.
 */
public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
  if (a == b)	return true;
  if (a == null || b == null) return false;
  int len = a.length;
  if (len != b.length) return false;
  if (len >= 2) {  // only need to sort if more than two items
    a = sortCopy(a);
    b = sortCopy(b);
  }
  for (int i = 0; i < len; ++i) {
    if (!a[i].equals(b[i])) return false;
  }
  return true;
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Compares two arrays using equals() on the elements.
 * The arrays are first sorted.
 * Either or both arrays may be null.
 * Returns true if both are null.
 * Returns false if only one is null.
 * If both are arrays, returns true iff they have the same length and
 * iff, after sorting both arrays, all elements compare true with equals.
 * The original arrays are left untouched.
 */
public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
  if (a == b)	return true;
  if (a == null || b == null) return false;
  int len = a.length;
  if (len != b.length) return false;
  if (len >= 2) {  // only need to sort if more than two items
    a = sortCopy(a);
    b = sortCopy(b);
  }
  for (int i = 0; i < len; ++i) {
    if (!a[i].equals(b[i])) return false;
  }
  return true;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

/**
 * Compares two String arrays using equals() on the elements.
 * The arrays are first sorted.
 * Either or both arrays may be null.
 * Returns true if both are null.
 * Returns false if only one is null.
 * If both are arrays, returns true iff they have the same length and
 * iff, after sorting both arrays, all elements compare true with equals.
 * The original arrays are left untouched.
 */
public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
  if (a == b)	return true;
  if (a == null || b == null) return false;
  int len = a.length;
  if (len != b.length) return false;
  if (len >= 2) {  // only need to sort if more than two items
    a = sortCopy(a);
    b = sortCopy(b);
  }
  for (int i = 0; i < len; ++i) {
    if (!a[i].equals(b[i])) return false;
  }
  return true;
}

代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps

/**
 * Compares two String arrays using equals() on the elements.
 * The arrays are first sorted.
 * Either or both arrays may be null.
 * Returns true if both are null.
 * Returns false if only one is null.
 * If both are arrays, returns true iff they have the same length and
 * iff, after sorting both arrays, all elements compare true with equals.
 * The original arrays are left untouched.
 */
public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
  if (a == b)	return true;
  if (a == null || b == null) return false;
  int len = a.length;
  if (len != b.length) return false;
  if (len >= 2) {  // only need to sort if more than two items
    a = sortCopy(a);
    b = sortCopy(b);
  }
  for (int i = 0; i < len; ++i) {
    if (!a[i].equals(b[i])) return false;
  }
  return true;
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

/**
 * Compares two String arrays using equals() on the elements.
 * The arrays are first sorted.
 * Either or both arrays may be null.
 * Returns true if both are null.
 * Returns false if only one is null.
 * If both are arrays, returns true iff they have the same length and
 * iff, after sorting both arrays, all elements compare true with equals.
 * The original arrays are left untouched.
 */
public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
  if (a == b)	return true;
  if (a == null || b == null) return false;
  int len = a.length;
  if (len != b.length) return false;
  if (len >= 2) {  // only need to sort if more than two items
    a = sortCopy(a);
    b = sortCopy(b);
  }
  for (int i = 0; i < len; ++i) {
    if (!a[i].equals(b[i])) return false;
  }
  return true;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Compares two arrays using equals() on the elements.
 * The arrays are first sorted.
 * Either or both arrays may be null.
 * Returns true if both are null.
 * Returns false if only one is null.
 * If both are arrays, returns true iff they have the same length and
 * iff, after sorting both arrays, all elements compare true with equals.
 * The original arrays are left untouched.
 */
public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
  if (a == b)	return true;
  if (a == null || b == null) return false;
  int len = a.length;
  if (len != b.length) return false;
  if (len >= 2) {  // only need to sort if more than two items
    a = sortCopy(a);
    b = sortCopy(b);
  }
  for (int i = 0; i < len; ++i) {
    if (!a[i].equals(b[i])) return false;
  }
  return true;
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

/**
 * Compares two arrays using equals() on the elements.
 * The arrays are first sorted.
 * Either or both arrays may be null.
 * Returns true if both are null.
 * Returns false if only one is null.
 * If both are arrays, returns true iff they have the same length and
 * iff, after sorting both arrays, all elements compare true with equals.
 * The original arrays are left untouched.
 */
public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
  if (a == b)	return true;
  if (a == null || b == null) return false;
  int len = a.length;
  if (len != b.length) return false;
  if (len >= 2) {  // only need to sort if more than two items
    a = sortCopy(a);
    b = sortCopy(b);
  }
  for (int i = 0; i < len; ++i) {
    if (!a[i].equals(b[i])) return false;
  }
  return true;
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

/**
 * Compares two String arrays using equals() on the elements.
 * The arrays are first sorted.
 * Either or both arrays may be null.
 * Returns true if both are null.
 * Returns false if only one is null.
 * If both are arrays, returns true iff they have the same length and
 * iff, after sorting both arrays, all elements compare true with equals.
 * The original arrays are left untouched.
 */
public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
  if (a == b)	return true;
  if (a == null || b == null) return false;
  int len = a.length;
  if (len != b.length) return false;
  if (len >= 2) {  // only need to sort if more than two items
    a = sortCopy(a);
    b = sortCopy(b);
  }
  for (int i = 0; i < len; ++i) {
    if (!a[i].equals(b[i])) return false;
  }
  return true;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

/**
 * Compares two String arrays using equals() on the elements.
 * The arrays are first sorted.
 * Either or both arrays may be null.
 * Returns true if both are null.
 * Returns false if only one is null.
 * If both are arrays, returns true iff they have the same length and
 * iff, after sorting both arrays, all elements compare true with equals.
 * The original arrays are left untouched.
 */
public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
  if (a == b)	return true;
  if (a == null || b == null) return false;
  int len = a.length;
  if (len != b.length) return false;
  if (len >= 2) {  // only need to sort if more than two items
    a = sortCopy(a);
    b = sortCopy(b);
  }
  for (int i = 0; i < len; ++i) {
    if (!a[i].equals(b[i])) return false;
  }
  return true;
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Compares two String arrays using equals() on the elements.
 * The arrays are first sorted.
 * Either or both arrays may be null.
 * Returns true if both are null.
 * Returns false if only one is null.
 * If both are arrays, returns true iff they have the same length and
 * iff, after sorting both arrays, all elements compare true with equals.
 * The original arrays are left untouched.
 */
public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
  if (a == b)	return true;
  if (a == null || b == null) return false;
  int len = a.length;
  if (len != b.length) return false;
  if (len >= 2) {  // only need to sort if more than two items
    a = sortCopy(a);
    b = sortCopy(b);
  }
  for (int i = 0; i < len; ++i) {
    if (!a[i].equals(b[i])) return false;
  }
  return true;
}

代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps

/**
 * Compares two arrays using equals() on the elements.
 * The arrays are first sorted.
 * Either or both arrays may be null.
 * Returns true if both are null.
 * Returns false if only one is null.
 * If both are arrays, returns true iff they have the same length and
 * iff, after sorting both arrays, all elements compare true with equals.
 * The original arrays are left untouched.
 */
public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
  if (a == b)	return true;
  if (a == null || b == null) return false;
  int len = a.length;
  if (len != b.length) return false;
  if (len >= 2) {  // only need to sort if more than two items
    a = sortCopy(a);
    b = sortCopy(b);
  }
  for (int i = 0; i < len; ++i) {
    if (!a[i].equals(b[i])) return false;
  }
  return true;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

/**
 * Compares two arrays using equals() on the elements.
 * The arrays are first sorted.
 * Either or both arrays may be null.
 * Returns true if both are null.
 * Returns false if only one is null.
 * If both are arrays, returns true iff they have the same length and
 * iff, after sorting both arrays, all elements compare true with equals.
 * The original arrays are left untouched.
 */
public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
  if (a == b)	return true;
  if (a == null || b == null) return false;
  int len = a.length;
  if (len != b.length) return false;
  if (len >= 2) {  // only need to sort if more than two items
    a = sortCopy(a);
    b = sortCopy(b);
  }
  for (int i = 0; i < len; ++i) {
    if (!a[i].equals(b[i])) return false;
  }
  return true;
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

/**
 * Compares two arrays using equals() on the elements.
 * The arrays are first sorted.
 * Either or both arrays may be null.
 * Returns true if both are null.
 * Returns false if only one is null.
 * If both are arrays, returns true iff they have the same length and
 * iff, after sorting both arrays, all elements compare true with equals.
 * The original arrays are left untouched.
 */
public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
  if (a == b)	return true;
  if (a == null || b == null) return false;
  int len = a.length;
  if (len != b.length) return false;
  if (len >= 2) {  // only need to sort if more than two items
    a = sortCopy(a);
    b = sortCopy(b);
  }
  for (int i = 0; i < len; ++i) {
    if (!a[i].equals(b[i])) return false;
  }
  return true;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Append a String to the given buffer representing the hierarchy for the type,
 * beginning with the specified indentation level.
 * If ascendant, shows the super types, otherwise show the sub types.
 */
private void toString(StringBuffer buffer, IJavaElement type, int indent, boolean ascendant) {
  IType[] types= ascendant ? getSupertypes((IType) type) : getSubtypes((IType) type);
  IJavaElement[] sortedTypes = Util.sortCopy(types);
  for (int i= 0; i < sortedTypes.length; i++) {
    toString(buffer, sortedTypes[i], indent + 1);
    toString(buffer, sortedTypes[i], indent + 1, ascendant);
  }
}
private void toString(StringBuffer buffer, IJavaElement type, int indent) {

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

/**
 * Append a String to the given buffer representing the hierarchy for the type,
 * beginning with the specified indentation level.
 * If ascendant, shows the super types, otherwise show the sub types.
 */
private void toString(StringBuffer buffer, IJavaElement type, int indent, boolean ascendant) {
  IType[] types= ascendant ? getSupertypes((IType) type) : getSubtypes((IType) type);
  IJavaElement[] sortedTypes = Util.sortCopy(types);
  for (int i= 0; i < sortedTypes.length; i++) {
    toString(buffer, sortedTypes[i], indent + 1);
    toString(buffer, sortedTypes[i], indent + 1, ascendant);
  }
}
private void toString(StringBuffer buffer, IJavaElement type, int indent) {

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

/**
 * Append a String to the given buffer representing the hierarchy for the type,
 * beginning with the specified indentation level.
 * If ascendant, shows the super types, otherwise show the sub types.
 */
private void toString(StringBuffer buffer, IJavaElement type, int indent, boolean ascendant) {
  IType[] types= ascendant ? getSupertypes((IType) type) : getSubtypes((IType) type);
  IJavaElement[] sortedTypes = Util.sortCopy(types);
  for (int i= 0; i < sortedTypes.length; i++) {
    toString(buffer, sortedTypes[i], indent + 1);
    toString(buffer, sortedTypes[i], indent + 1, ascendant);
  }
}
private void toString(StringBuffer buffer, IJavaElement type, int indent) {

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

/**
 * Append a String to the given buffer representing the hierarchy for the type,
 * beginning with the specified indentation level.
 * If ascendant, shows the super types, otherwise show the sub types.
 */
private void toString(StringBuffer buffer, IJavaElement type, int indent, boolean ascendant) {
  IType[] types= ascendant ? getSupertypes((IType) type) : getSubtypes((IType) type);
  IJavaElement[] sortedTypes = Util.sortCopy(types);
  for (int i= 0; i < sortedTypes.length; i++) {
    toString(buffer, sortedTypes[i], indent + 1);
    toString(buffer, sortedTypes[i], indent + 1, ascendant);
  }
}
private void toString(StringBuffer buffer, IJavaElement type, int indent) {

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Append a String to the given buffer representing the hierarchy for the type,
 * beginning with the specified indentation level.
 * If ascendant, shows the super types, otherwise show the sub types.
 */
private void toString(StringBuffer buffer, IJavaElement type, int indent, boolean ascendant) {
  IType[] types= ascendant ? getSupertypes((IType) type) : getSubtypes((IType) type);
  IJavaElement[] sortedTypes = Util.sortCopy(types);
  for (int i= 0; i < sortedTypes.length; i++) {
    toString(buffer, sortedTypes[i], indent + 1);
    toString(buffer, sortedTypes[i], indent + 1, ascendant);
  }
}
private void toString(StringBuffer buffer, IJavaElement type, int indent) {

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

/**
 * Append a String to the given buffer representing the hierarchy for the type,
 * beginning with the specified indentation level.
 * If ascendant, shows the super types, otherwise show the sub types.
 */
private void toString(StringBuffer buffer, IJavaElement type, int indent, boolean ascendant) {
  IType[] types= ascendant ? getSupertypes((IType) type) : getSubtypes((IType) type);
  IJavaElement[] sortedTypes = Util.sortCopy(types);
  for (int i= 0; i < sortedTypes.length; i++) {
    toString(buffer, sortedTypes[i], indent + 1);
    toString(buffer, sortedTypes[i], indent + 1, ascendant);
  }
}
private void toString(StringBuffer buffer, IJavaElement type, int indent) {

相关文章

微信公众号

最新文章

更多

Util类方法