java 方法 示例

集合类asLifoQueue()方法 (Collections Class asLifoQueue() method)

  • asLifoQueue() Method is available in java.lang package.

    asLifoQueue()方法在java.lang包中可用。

  • asLifoQueue() Method is used to represent the given deque as a Lifo queue (LIFO means Last-in-First-Out).

    asLifoQueue()方法用于将给定的双端队列表示为Lifo队列(LIFO表示后进先出)。

  • asLifoQueue() Method is a static method, so it is accessible with the class name and if we try to access the method with the class object then we will not get an error.

    asLifoQueue()方法是一个静态方法,因此可以使用类名进行访问,如果尝试使用类对象访问该方法,则不会收到错误。

  • asLifoQueue() Method does not throw an exception at the time of conversion from given Deque to LIFO Queue.

    从给定的双端队列转换为LIFO队列时, asLifoQueue()方法不会引发异常。

Syntax:

句法:

    public static Queue asLifoQueue(Deque d);

Parameter(s):

参数:

  • Deque d – represent the Deque.

    双端队列d –表示双端队列。

Return value:

返回值:

The return type of the method is Queue, it returns LIFO Queue.

该方法的返回类型为Queue ,它返回LIFO Queue。

Example:

例:

// Java Program is to demonstrate the example
// of Queue asLifoQueue(Deque d) method of Collections class
import java.util.*;
public class AsLifoQueue {public static void main(String args[]) {// Create a array deque object
Deque de = new ArrayDeque(10);
// By using add() method is to add the
// given elements in linked list
de.add("C");
de.add("C++");
de.add("JAVA");
de.add("DOTNET");
de.add("PYTHON");
// Display Deque
System.out.println("de: " + de);
// By using asLifoQueue() method is to
// represent the deque elements as lifo queue
Queue lifo_q = Collections.asLifoQueue(de);
System.out.println();
System.out.println("Collections.asLifoQueue(de) :");
// Display Queue
System.out.println("lifo_q: " + lifo_q);
}
}

Output

输出量

de: [C, C++, JAVA, DOTNET, PYTHON]Collections.asLifoQueue(de) :
lifo_q: [C, C++, JAVA, DOTNET, PYTHON]

翻译自: https://www.includehelp.com/java/collections-aslifoqueue-method-with-example.aspx

java 方法 示例

java 方法 示例_Java集合asLifoQueue()方法和示例相关推荐

  1. List精讲(Java版)·算法常用集合处理方法

    List精讲(Java版)·算法常用集合处理方法 请仔细查阅每一个注释: import java.util.ArrayList; import java.util.Collections; impor ...

  2. java 方法 示例_Java集合syncedSet()方法与示例

    java 方法 示例 集合类syncedSet()方法 (Collections Class synchronizedSet() method) synchronizedSet() method is ...

  3. java set 包含_Java Set.contains()方法:判断Set集合是否包含指定的对象

    Java 集合类中的 Set.contains() 方法判断 Set 集合是否包含指定的对象.该方法返回值为 boolean 类型,如果 Set 集合包含指定的对象,则返回 true,否则返回 fal ...

  4. java secretkey用法_Java SecretKeyFactory.generateSecret方法代码示例

    本文整理汇总了Java中javax.crypto.SecretKeyFactory.generateSecret方法的典型用法代码示例.如果您正苦于以下问题:Java SecretKeyFactory ...

  5. java集合的遍历_java集合遍历方法总结

    java集合遍历方法总结 一.for循环遍历集合 使用条件: ①能否确定集合中的元素个数 ②集合是否可以通过整数索引值来精确位置 public static void forTraversal(){ ...

  6. java中断响应时间_Java多线程 sleep方法响应中断 sleep面试问题(与wait/notify的

    Java多线程 sleep方法响应中断 sleep面试问题(与wait/notify的 Java多线程 sleep方法响应中断 & sleep面试问题(与wait/notify的比较) 文章目 ...

  7. java wait 参数_Java Object wait()方法

    Java Object wait()方法 java.lang.Object.wait(long timeout, int nanos) 导致当前线程等待,直到其他线程调用此对象的 notify() 方 ...

  8. java printwriter追加_Java PrintWriter append()方法

    Java PrintWriter append()方法 java.io.PrintWriter.append(char c) 方法将指定字符到此Writer. 1 语法 public PrintWri ...

  9. java 发送邮件 菜鸟_Java发送邮件的方法

    1.需要的jar包 2.具体实现方法 1.设置邮箱主机.需要认证.邮箱协议 Properties pro=new Properties(); pro.setProperty("mail.ho ...

最新文章

  1. centos7安装mongodb3.4
  2. Centos 5.5下面架设NTP服务器
  3. 多线程与高并发(五):强软弱虚四种引用以及ThreadLocal的原理与源码
  4. 微信小程序 - 骨架屏
  5. 请求地址操作中的(int*)
  6. JavaScript基本概念(下)
  7. oracle获取去年年份_「实战」中文检错纠错之语料获取与处理
  8. python期望输出隐藏_【归纳综述】马尔可夫、隐马尔可夫 HMM 、条件随机场 CRF 全解析及其python实现...
  9. 分享OUTLOOK的定时发送功能
  10. LINUX SHELL脚本多行注释
  11. redhat linux防火墙状态,Redhat下配置iptables防火墙
  12. Using SVN with Ant
  13. 微信公众号引流的平台有哪些?
  14. java 斑马_java调用斑马GK888t打印机(ZPL指令)
  15. 相对比性能稳定速度快的香港服务器有哪些
  16. 虚拟机ping不通主机
  17. ad18差分布线,设置差分对
  18. 传输层 --- 面向连接的传输TCP
  19. nz-modal of ng-zorro supports browser height
  20. Coherence-Enhancing Shock Filters 代码及详细注释【OpenCV】

热门文章

  1. 利用人工智能提升团队包容性
  2. Linux VirtualBox安装及使用指南
  3. 前端架构设计1:代码核心
  4. Windows10下手工强制清理删掉安装版的JRE8导致java.exe无法运行的解决办法
  5. 使用 nvm 安装 nodejs 和 npm
  6. 分布式系统的唯一ID
  7. 数据分析告诉你为什么Apple Watch会大卖?
  8. .Net判断一个对象是否为数值类型探讨总结(高营养含量,含最终代码及跑分)...
  9. 淘宝山寨IOS sdk
  10. 常用Oracle分析函数详解