`
metalsliver
  • 浏览: 24604 次
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

java.util示例代码大全

阅读更多
Home > List of Packages


java.util
e331. 产生一个随机数
e332. 将一个字符串分解成字
e333. 建立一个定制事件
e334. 实现一个简单的事件通知器
e335. 列出所有可用的地区
e336. 设置默认地区
e337. 将一个值与一个对象联系起来

Arrays
--------------------------------------------------------------------------------
e338. 数组比较
e1074. 装填数组
e339. 打乱一个列表或数组的元素
e340. 将一个收集器装换成一个数组
e341. 将一个数组转换成一个收集器

Collections
--------------------------------------------------------------------------------
e342. 实现一个队列
e343. 实现一个栈
e344. 实现一个最近最少使用的(LRU)高速缓存
e345. 遍历一个收集器中的元素
e346. 用收集器存储基本类型
e347. 建立一个收集器的副本
e348. 将一个收集器设为只读的

Lists
--------------------------------------------------------------------------------
e349. 建立一个列表
e350. 将一个列表排序
e351. 对列表进行操作
e1075. 创建一个确切型别的列表

Sets
--------------------------------------------------------------------------------
e352. 建立一个集合
e353. 操作一个集合
e354. 建立一个保持插入次序的集合

Hash Tables
--------------------------------------------------------------------------------
e355. 建立一个散列表
e356. 建立一个维护插入次序的MAP
e357. 自动从三列表中删除没有引用的元素
e1076. 创建一个确切型别的Map

Sorted Collections
--------------------------------------------------------------------------------
e358. 建立一个排序的集合
e359. 对数组进行排序
e360. 在一个排序数组中查找一个元素
e1077. 在一个排序数组中插入元素
e361. 在一个排序列表中查找一个元素
e362. 在一个排序列表中插入元素

Bits
--------------------------------------------------------------------------------
e363. 对一个位指针进行位操作
e364. 在BitSet和字节数组之间进行转换

Property Files
--------------------------------------------------------------------------------
e365. 读取和写入一个属性文件
e366. 获取并设置属性

Timers
--------------------------------------------------------------------------------
e367. 调度一个计时器任务,使其在特定时间执行
e368. 调度一个计时器任务,让它重复执行

Time
--------------------------------------------------------------------------------
e369. 获取当前时间
e370. 获取另一个时区的当前时间
e371. 检索所有可用时区的信息
e372. 在时区之间进行时间转换

Dates
--------------------------------------------------------------------------------
e373. 获取当前日期
e374. 为特定日期建立一个Date对象
e375. 确定一个月当中的天数
e376. 日期比较
e377. 确定一个人的年龄
e378. 确定某年是否是闰年
e379. 确定某一天是星期几

分享到:
评论
20 楼 metalsliver 2006-11-26  
这个bug已提交bug贴,版主,这篇是良好贴,好多人都喜欢,别锁了。。
19 楼 metalsliver 2006-11-26  
帖子被锁了!看看能不能发
18 楼 eltonto 2006-11-22  
楼主万岁
17 楼 metalsliver 2006-11-21  
java参考中文站(在原有1094个中文示例)下的近期更新!

新加入 hibernate             示例90个
新加入 spring                示例60个
新加入 开发模式              示例74个
新加入 apache common包的应用 示例67个
新加入 ant                   示例87个
新加入 j2me                  示例220个
.....
共更新java相关示例代码 4995例,欢迎广大java学者访问学习!
16 楼 IamNull 2006-11-08  
呵呵, 上来看看,温故知新阿
15 楼 metalsliver 2006-11-08  
抛出异常的爱 写道
很是有用
不过这个例子集是否都是jdk的例子呢?
http://www.javaref.cn/egs/index.html
有没有hibernate的例子集呢?


嘿,这个网站关注的人越来越多了,
这几天正在添加hibernate和spring的例子,
不出意外的话,下周你能看到!
14 楼 metalsliver 2006-11-08  
henryno11 写道
有没有ResourceBundle的使用实例.


e310. 将消息本地化
Messages and text string should be localized in a resource bundle. There are several types of resource bundles. This example demonstrates how to use a property-file type resource bundle. Here are two examples of resource files:
MyResources_en.properties:

    hello=Hello
    bye=Goodbye

MyResources_fr.properties:
    hello=Bonjour
    bye=Au Revoir

When loading a property-file resource bundle, a base name and desired locale is specified. The system then looks in the classpath for a file whose name matches one of the following patterns in order:
   
basename_locale.properties
    basename.properties
    basename_defaultLocale.properties

For example, given the base name MyResources, a locale of fr, and a default locale of en, the system first looks for
    MyResources_fr.properties
    MyResources.properties
    MyResources_en.properties

Here's an example that loads a resource bundle:
    String baseName = "MyResources";
    try {
        // Get the resource bundle for the default locale
        ResourceBundle rb = ResourceBundle.getBundle(baseName);
   
        String key = "hello";
        String s = rb.getString(key); // Hello
        key = "bye";
        s = rb.getString(key);        // Goodbye
   
        // Get the resource bundle for a specific locale
        rb = ResourceBundle.getBundle(baseName, Locale.FRENCH);
   
        key = "hello";
        s = rb.getString(key);        // Bonjour
        key = "bye";
        s = rb.getString(key);        // Au Revoir
    } catch (MissingResourceException e) {
        // The resource bundle cannot be found or
        // the key does not exist in the resource bundle
    }

http://www.javaref.cn/egs/java.text/LocMsg.html



13 楼 intolong 2006-10-26  
还不错,不过JDK document还是应该看看。
12 楼 icefire 2006-10-26  
多多学习!!
11 楼 henryno11 2006-10-25  
有没有ResourceBundle的使用实例.
10 楼 翅膀 2006-10-16  
不错,util是我们最熟悉的包了。
9 楼 tuotuo 2006-10-16  
不错不错,看ing!
8 楼 spinach 2006-10-09  
辛苦了,继续添加更多的好例子。谢谢!
7 楼 metalsliver 2006-10-09  
抛出异常的爱 写道
很是有用
不过这个例子集是否都是jdk的例子呢?
http://www.javaref.cn/egs/index.html
有没有hibernate的例子集呢?


hibernate得下载包里面好像有很多例子,
别的例子了解的不是很多。。
谁如果有更好的例子和资源,不妨贴出来大家共享!
6 楼 sizhefang 2006-10-06  
帮助很大,雷兄!
5 楼 抛出异常的爱 2006-10-06  
很是有用
不过这个例子集是否都是jdk的例子呢?
http://www.javaref.cn/egs/index.html
有没有hibernate的例子集呢?
4 楼 metalsliver 2006-10-01  
javaalmanac
这个东东是java开发者年鉴,(美)Patrick Chan写的
从98年开始差不多每年都要新加一些新的方法代码
并不按jdk版本更新
3 楼 cryolite 2006-10-01  
javaalmanac还没有升到1.5吗
2 楼 metalsliver 2006-10-01  

猜中!
每天都用javaalmanac,
全英文看起来不爽,
把标题翻译一下,现在看起来舒服多了
1 楼 galaxystar 2006-10-01  
还不错,怀念一下!!
网站是你做的吗?

相关推荐

Global site tag (gtag.js) - Google Analytics