java.util.LinkedList.element()方法的使用及代码示例

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

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

LinkedList.element介绍

[英]Retrieves, but does not remove, the head (first element) of this list.
[中]检索但不删除此列表的头(第一个元素)。

代码示例

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

tg = sigma.element();
wl = worklists.get(tg);
if (wl.isEmpty()) {

代码示例来源:origin: julian-klode/dns66

void add(WaitingOnSocketPacket wosp) {
  if (list.size() > DNS_MAXIMUM_WAITING) {
    Log.d(TAG, "Dropping socket due to space constraints: " + list.element().socket);
    list.element().socket.close();
    list.remove();
  }
  while (!list.isEmpty() && list.element().ageSeconds() > DNS_TIMEOUT_SEC) {
    Log.d(TAG, "Timeout on socket " + list.element().socket);
    list.element().socket.close();
    list.remove();
  }
  list.add(wosp);
}

代码示例来源:origin: iTXTech/Daedalus

void add(WaitingOnSocketPacket wosp) {
  if (list.size() > 1024) {
    Log.d(TAG, "Dropping socket due to space constraints: " + list.element().socket);
    list.element().socket.close();
    list.remove();
  }
  while (!list.isEmpty() && list.element().ageSeconds() > 10) {
    Log.d(TAG, "Timeout on socket " + list.element().socket);
    list.element().socket.close();
    list.remove();
  }
  list.add(wosp);
}

代码示例来源:origin: iTXTech/Daedalus

void add(TcpProvider.WaitingOnSocketPacket wosp) {
  try {
    if (list.size() > 1024) {
      Log.d(TAG, "Dropping socket due to space constraints: " + list.element().socket);
      list.element().socket.close();
      list.remove();
    }
    while (!list.isEmpty() && list.element().ageSeconds() > 10) {
      Log.d(TAG, "Timeout on socket " + list.element().socket);
      list.element().socket.close();
      list.remove();
    }
    list.add(wosp);
  } catch (Exception ignored) {
  }
}

代码示例来源:origin: com.netflix.rxjava/rxjava-core

public synchronized T element() {
  return list.element();
}

代码示例来源:origin: thombergs/diffparser

@Override
public String getFocusLine() {
  return lineQueue.element();
}

代码示例来源:origin: com.virjar/dungproxy-client

@Override
public T element() {
  lock.lock();
  try {
    return super.element();
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: stackoverflow.com

LinkedList<ArrayList<String>> partials = new LinkedList<ArrayList<String>>();
ArrayList<String> list = new ArrayList<String>();
list.add("Test");

// Create a shallow copy and add a reference to that into the linked list
partials.add(new ArrayList<String>(list));

list.add("Another element");

// Prints 1, because the lists are distinct
System.out.println(partials.element().size());

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

@Override
public T element() {
  return Pure4J.returnImmutable(((LinkedList<T>)wrapped).element());
}

代码示例来源:origin: org.apache.openejb.patch/openjpa-kernel

@Override
public Object element() {
  if (!_directAccess && isDelayLoad()) {
    load();
  }
  return super.element();
}

代码示例来源:origin: org.apache.openejb.patch/openjpa

@Override
public Object element() {
  if (!_directAccess && isDelayLoad()) {
    load();
  }
  return super.element();
}

代码示例来源:origin: org.apache.openjpa/openjpa-kernel

@Override
public Object element() {
  if (!_directAccess && isDelayLoad()) {
    load();
  }
  return super.element();
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

@Override
public Object element() {
  if (!_directAccess && isDelayLoad()) {
    load();
  }
  return super.element();
}

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

@Override
public Item next() throws Exception {
 while (input.hasNext()) {
  int _type = input.next();
  switch (_type) {
   case XMLStreamReader.START_ELEMENT :
    if (startName != null) {
     hierarchy.push(startName);
     startName = input.getLocalName();
     return returnNest(hierarchy.element());
    }
    startName = input.getLocalName(); break;
   case XMLStreamReader.CHARACTERS :
    value = input.getText(); break;
   case XMLStreamReader.END_ELEMENT :
    String _name = input.getLocalName();
    if (startName != null && startName.equals(_name)) {
     startName = null;
     return returnProperty(_name, value);
    }
    if (_name.equals(hierarchy.element())) {
     hierarchy.pop();
     return returnUnnest();
    }
    break;
  }
 }
 return null;
}

代码示例来源:origin: org.cache2k/cache2k-impl

@Override
public Item next() throws Exception {
 while (input.hasNext()) {
  int _type = input.next();
  switch (_type) {
   case XMLStreamReader.START_ELEMENT :
    if (startName != null) {
     hierarchy.push(startName);
     startName = input.getLocalName();
     return returnNest(hierarchy.element());
    }
    startName = input.getLocalName(); break;
   case XMLStreamReader.CHARACTERS :
    value = input.getText(); break;
   case XMLStreamReader.END_ELEMENT :
    String _name = input.getLocalName();
    if (startName != null && startName.equals(_name)) {
     startName = null;
     return returnProperty(_name, value);
    }
    if (_name.equals(hierarchy.element())) {
     hierarchy.pop();
     return returnUnnest();
    }
    break;
  }
 }
 return null;
}

代码示例来源:origin: org.cache2k/cache2k-xml-configuration

@Override
public Item next() throws Exception {
 while (input.hasNext()) {
  int _type = input.next();
  switch (_type) {
   case XMLStreamReader.START_ELEMENT :
    if (startName != null) {
     hierarchy.push(startName);
     startName = input.getLocalName();
     return returnNest(hierarchy.element());
    }
    startName = input.getLocalName(); break;
   case XMLStreamReader.CHARACTERS :
    value = input.getText(); break;
   case XMLStreamReader.END_ELEMENT :
    String _name = input.getLocalName();
    if (startName != null && startName.equals(_name)) {
     startName = null;
     return returnProperty(_name, value);
    }
    if (_name.equals(hierarchy.element())) {
     hierarchy.pop();
     return returnUnnest();
    }
    break;
  }
 }
 return null;
}

代码示例来源:origin: BruceEckel/OnJava8-Examples

"pets.getFirst(): " + pets.getFirst());
System.out.println(
 "pets.element(): " + pets.element());

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

@Override
public Item next() throws Exception {
 int _eventType;
 while ((_eventType = nextEvent()) != XmlPullParser.END_DOCUMENT) {
  switch (_eventType) {
   case XmlPullParser.START_TAG :
    if (startName != null) {
     hierarchy.push(startName);
     startName = input.getName();
     return returnNest(hierarchy.element());
    }
    startName = input.getName(); break;
   case XmlPullParser.TEXT :
    value = input.getText();
    break;
   case XmlPullParser.END_TAG :
    String _name = input.getName();
    if (startName != null && startName.equals(_name)) {
     startName = null;
     return returnProperty(_name, value);
    }
    if (_name.equals(hierarchy.element())) {
     hierarchy.pop();
     return returnUnnest();
    }
    break;
  }
 }
 return null;
}

代码示例来源:origin: org.tomitribe/tomitribe-util

@Override
  protected File advance() throws NoSuchElementException {
    final FileIterator current = stack.element();
    try {
      final File file = current.advance();
      if (file == null) {
        stack.pop();
        return advance();
      }
      if (file.isDirectory()) {
        stack.push(new FileIterator(file));
      }
      return file;
    } catch (final NoSuchElementException e) {
      stack.pop();
      return advance();
    }
  }
}

代码示例来源:origin: org.cache2k/cache2k-impl

@Override
public Item next() throws Exception {
 int _eventType;
 while ((_eventType = nextEvent()) != XmlPullParser.END_DOCUMENT) {
  switch (_eventType) {
   case XmlPullParser.START_TAG :
    if (startName != null) {
     hierarchy.push(startName);
     startName = input.getName();
     return returnNest(hierarchy.element());
    }
    startName = input.getName(); break;
   case XmlPullParser.TEXT :
    value = input.getText();
    break;
   case XmlPullParser.END_TAG :
    String _name = input.getName();
    if (startName != null && startName.equals(_name)) {
     startName = null;
     return returnProperty(_name, value);
    }
    if (_name.equals(hierarchy.element())) {
     hierarchy.pop();
     return returnUnnest();
    }
    break;
  }
 }
 return null;
}

相关文章