易截截图软件、单文件、免安装、纯绿色、仅160KB

Object Ordering java 排序

Object Ordering
A List l may be sorted as follows.
Collections.sort(l);
If the List consists of String elements, it will be sorted into alphabetical order. If it consists of Date elements, it will be sorted into chronological order. How does this happen? String and Date both implement the Comparable interface. Comparable implementations provide a natural ordering for a class, which allows objects of that class to be sorted automatically. The following table summarizes some of the more important Java platform classes that implement Comparable.
Classes Implementing Comparable
ClassNatural Ordering
Byte
Signed numerical
Character
Unsigned numerical
Long
Signed numerical
Integer
Signed numerical
Short
Signed numerical
Double
Signed numerical
Float
Signed numerical
BigInteger
Signed numerical
BigDecimal
Signed numerical
Boolean
Boolean.FALSE < Boolean.TRUE
File
System-dependent lexicographic on path name
String
Lexicographic
Date
Chronological
CollationKey
Locale-specific lexicographic
If you try to sort a list, the elements of which do not implement Comparable, Collections.sort(list) will throw a ClassCastException. Similarly, Collections.sort(list, comparator) will throw a ClassCastException if you try to sort a list whose elements cannot be compared to one another using the comparator. Elements that can be compared to one another are called mutually comparable. Although elements of different types may be mutually comparable, none of the classes listed here permit interclass comparison.
This is all you really need to know about the Comparable interface if you just want to sort lists of comparable elements or to create sorted collections of them. The next section will be of interest to you if you want to implement your own Comparable type.
Writing Your Own Comparable Types
The Comparable interface consists of the following method.
public interface Comparable<T> {
public int compareTo(T o);
}
The compareTo method c


相关文档:

java数据结构之树集TreeSet与书映射(TreeMap)

1.树集TreeSet
     TreeSet类在java.util包中
     树集中的结点是按着其存放的数据的字典序一层一层地依次排列  在同一层中的结点从左到右按字典序递增排列
     A.构造方法:TreeSet()
     B.常用方法
   & ......

JSON Java与AJAX(Jquery)

一、JSON 是什么?
JSON 的全称是JavaScript Object Notation,是一种轻量级的数据交换格式。
JSON 与XML 具有相同的特性,例如易于人编写和阅读,易于机器生成和解析。但是JSON 比
XML 数据传输的有效性要高出很多。JSON 完全独立与编程语言,使用文本格式保存。
JSON 数据有两种结构:
• Name-Value 对构成的集 ......

在Java 3D中载入外部3D模型文件

Java 3D虽然能支持众多的外部3D模型文件,但能支持被Java 3D使用的外部模型文件仅为.obj和.lwd两种;分别对应ObjectFile类和Lw3dLoader类。相比之下几款主流的3D建模软件都能生成.obj格式的文件,因此本文主要介绍使用ObjectFile类载入.obj文件的方法。
ObjectFile类有三个构造方法,分别为:
ObjectFile()
ObjectFile( ......

MySQL Java 开发套装

MySQL Java 开发套装(服务器,管理工具,JDBC驱动,示例代码)
小更新: 为了减轻负担, 用 MySQL-Front 2.5 来管理, 这个软件无中文问题. 如果以后开源版本HeidiSQL的解决了中文问题, 就用开源的.
下载: http://tomcatmonitor.googlecode.com/files/portable_mysql5.exe  4.02MB (自解压包)
参考文档: MySQL 5 绿色 ......

Java自学小结——2

最近应老师的要求看了数据库。在网上找了视频,是个教育机构发的。那个视频看得我直犯困,除了老师讲课讲错的时候。
视频讲得很浅显,第一章讲了sql数据库结构,有什么模型。接着讲主键,外键,然后是建表语句,查询语句等等。
show databases 显示数据库。
use ** 使用数据库。
create table ** (**,**,**) 建表。
se ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号