com.sun.tools.javac.util.List.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(207)

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

List.<init>介绍

[英]Construct a list given its head and tail.
[中]根据列表的开头和结尾构造一个列表。

代码示例

代码示例来源:origin: sc.fiji/javac

public final void clear() {
  this.elems = new List<A>(null,null);
  this.last = this.elems;
  count = 0;
  shared = false;
}

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

/** Prepend given element to front of list, forming and returning
 *  a new list.
 */
public List<A> prepend(A x) {
return new List<A>(x, this);
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

/** Prepend given element to front of list, forming and returning
 *  a new list.
 */
public List<A> prepend(A x) {
  return new List<A>(x, this);
}

代码示例来源:origin: konsoletyper/teavm-javac

/** Construct a list consisting of given elements.
 */
@SuppressWarnings({"varargs", "unchecked"})
public static <A> List<A> of(A x1, A x2, A x3, A... rest) {
  return new List<A>(x1, new List<A>(x2, new List<A>(x3, from(rest))));
}

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

/** Construct a list consisting of a given number of identical elements.
 *  @param len    The number of elements in the list.
 *  @param init   The value of each element.
 */
@Deprecated
public static <A> List<A> fill(int len, A init) {
List<A> l = nil();
for (int i = 0; i < len; i++) l = new List<A>(init, l);
return l;
}

代码示例来源:origin: sc.fiji/javac

/** Construct a list consisting of given element.
 */
public static <A> List<A> of(A x1) {
  return new List<A>(x1, List.<A>nil());
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

/** Construct a list consisting of given element.
 */
public static <A> List<A> of(A x1) {
  return new List<A>(x1, List.<A>nil());
}

代码示例来源:origin: sc.fiji/javac

/** Construct a list consisting of given elements.
 */
public static <A> List<A> of(A x1, A x2, A x3) {
  return new List<A>(x1, of(x2, x3));
}

代码示例来源:origin: konsoletyper/teavm-javac

/** Construct a list consisting of a given number of identical elements.
 *  @param len    The number of elements in the list.
 *  @param init   The value of each element.
 */
@Deprecated
public static <A> List<A> fill(int len, A init) {
  List<A> l = nil();
  for (int i = 0; i < len; i++) l = new List<A>(init, l);
  return l;
}

代码示例来源:origin: konsoletyper/teavm-javac

/** Construct a list consisting of given elements.
 */
public static <A> List<A> of(A x1, A x2, A x3) {
  return new List<A>(x1, of(x2, x3));
}

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

/** Construct a list consisting of given elements.
 */
public static <A> List<A> of(A x1, A x2, A x3) {
return new List<A>(x1, of(x2, x3));
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

/** Construct a list consisting of given elements.
 */
public static <A> List<A> of(A x1, A x2, A x3) {
  return new List<A>(x1, of(x2, x3));
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac

/**
 * Construct a list consisting all elements of given array.
 * @param array an array; if {@code null} return an empty list
 */
public static <A> List<A> from(A[] array) {
  List<A> xs = nil();
  if (array != null)
    for (int i = array.length - 1; i >= 0; i--)
      xs = new List<A>(array[i], xs);
  return xs;
}

代码示例来源:origin: sc.fiji/javac

/**
 * Construct a list consisting all elements of given array.
 * @param array an array; if {@code null} return an empty list
 */
public static <A> List<A> from(A[] array) {
  List<A> xs = nil();
  if (array != null)
    for (int i = array.length - 1; i >= 0; i--)
      xs = new List<A>(array[i], xs);
  return xs;
}

代码示例来源:origin: sc.fiji/javac

/** Construct a list consisting of a given number of identical elements.
 *  @param len    The number of elements in the list.
 *  @param init   The value of each element.
 */
@Deprecated
public static <A> List<A> fill(int len, A init) {
  List<A> l = nil();
  for (int i = 0; i < len; i++) l = new List<A>(init, l);
  return l;
}

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

/** Construct a list consisting of given element.
 */
public static <A> List<A> of(A x1) {
return new List<A>(x1, List.<A>nil());
}

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

/** Construct a list consisting of given elements.
 */
public static <A> List<A> of(A x1, A x2) {
return new List<A>(x1, of(x2));
}

代码示例来源:origin: sc.fiji/javac

/** Append an element to buffer.
 */
public ListBuffer<A> append(A x) {
  x.getClass(); // null check
  if (shared) copy();
  last.head = x;
  last.setTail(new List<A>(null,null));
  last = last.tail;
  count++;
  return this;
}

代码示例来源:origin: org.jvnet.sorcerer/sorcerer-javac

/** Append an element to buffer.
 */
public ListBuffer<A> append(A x) {
if (shared) copy();
last.head = x;
last.setTail(new List<A>(null,null));
last = last.tail;
count++;
return this;
}

代码示例来源:origin: sc.fiji/javac

/** Reverse list.
 * If the list is empty or a singleton, then the same list is returned.
 * Otherwise a new list is formed.
 */
public List<A> reverse() {
  // if it is empty or a singleton, return itself
  if (isEmpty() || tail.isEmpty())
    return this;
  List<A> rev = nil();
  for (List<A> l = this; l.nonEmpty(); l = l.tail)
    rev = new List<A>(l.head, rev);
  return rev;
}

相关文章