package text;

import java.util.ArrayList;
import java.util.List; public class Text { public static void main(String[] args) {
//创建一个Integer集合的链表
List<Integer> l = new ArrayList<Integer>();
//当链表种存在15个数时结束像链表种插入数据
while(l.size()<15){
int i = (int)(Math.random()*15+1);
if(!l.contains(i))
l.add(i);
}
//迭代,输出链表中的元素
//for(int j:l)
// System.out.println(j);
for(int i=0;i<l.size();i++)
{
System.out.println(l.get(i));
} }
}

输出:(答案不唯一,随机数)

8

15

10

14

9

3

6

11

5

13

4

7

12

1

2

最新文章

  1. navigationController 去掉背景图片、去掉底部线条
  2. linux(centos)用户与权限
  3. Linux学习历程(持续更新整理中)
  4. 远程登录,无法加载explorer
  5. 两台笔记本搭建openvswitch网络
  6. MSSQLSERVER数据库- 杂记
  7. Queues 队列
  8. python中金额计算的小问题
  9. CentOs 系统启动流程相关
  10. zabbix3.2源码搭建
  11. 为什么要进行URL编码
  12. 区块链共识机制(POW、POS、DPOS等)的优缺点
  13. 微信小程序开发工具中快捷键
  14. CBSN NEWS
  15. 网络I/O模型---同步异步阻塞非阻塞之惑
  16. beego 初体验 - 基础模块 - config, httplibs, logs
  17. 网络(socket)编程
  18. (C/C++学习笔记) 五. 常变量(只读变量)和宏
  19. windows下能搭建php-fpm吗 phpstudy
  20. 软件工程github使用小结

热门文章

  1. 点击导航目录页面滑动到指定div区域
  2. vue和react区别
  3. [leetcode] 题解记录 1-10
  4. 【ExtJs】获取grid选中的records
  5. Redis之淘汰策略
  6. input type 为 number 时去掉上下小箭头
  7. css高度居中
  8. go语言中获取变量类型的三种方法
  9. Redis总结2
  10. mybatis报错,There is no getter for property named &#39;templateName&#39; in &#39;class