⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sortobject.java.htm

📁 一些网上收集的或是作者本人写的值得推荐的源程序代码.
💻 HTM
字号:
<HTML><HEAD><TITLE>/server/http/document/java/SortObject.java.html</TITLE></HEAD><BODY BGcolor=#FFFFFF TEXT=#000000><PRE><FONT color=#0000f8>/*</FONT><FONT color=#0000f8> * put your module comment here</FONT><FONT color=#0000f8> * formatted with JxBeauty (c) johann.langhofer@nextra.at</FONT><FONT color=#0000f8> */</FONT><FONT color=#0000f8>/**</FONT><FONT color=#0000f8> *</FONT><FONT color=#6858c8> put your documentation comment here</FONT><FONT color=#6858c8> </FONT><FONT color=#0000f8>*/</FONT><B><FONT color=#288850>public</FONT></B> <B><FONT color=#288850>class</FONT></B> SortObjects {    <FONT color=#0000f8>/**</FONT><FONT color=#0000f8>     *</FONT><FONT color=#6858c8> put your documentation comment here</FONT><FONT color=#0000f8>     *</FONT><FONT color=#6858c8> </FONT><FONT color=#6858c8>@param</FONT><FONT color=#008888> s[]</FONT><FONT color=#0000f8>     */</FONT>    <B><FONT color=#288850>public</FONT></B> <B><FONT color=#288850>static</FONT></B> <B><FONT color=#288850>void</FONT></B> main (String s[]) {        Collections col;        List l = sort(s);        System.out.println(<FONT color=#f800f8>&quot;</FONT><FONT color=#6858c8>\n</FONT><FONT color=#f800f8>Strings sorted List ...&quot;</FONT>);        <B><FONT color=#a02828>for</FONT></B> (<B><FONT color=#288850>int</FONT></B> i = <FONT color=#f800f8>0</FONT>; i &lt; s.length; i++) {            System.out.println((String)l.get(i));        }        <B><FONT color=#288850>int</FONT></B> ints[] =  {            <FONT color=#f800f8>11</FONT>, <FONT color=#f800f8>2</FONT>, -<FONT color=#f800f8>22</FONT>, <FONT color=#f800f8>401</FONT>, <FONT color=#f800f8>6</FONT>        };        Integer in[] = <B><FONT color=#a02828>new</FONT></B> Integer[ints.length];        <B><FONT color=#a02828>for</FONT></B> (<B><FONT color=#288850>int</FONT></B> i = <FONT color=#f800f8>0</FONT>; i &lt; in.length; i++) {            in[i] = <B><FONT color=#a02828>new</FONT></B> Integer(ints[i]);        }        l = sort(in);        System.out.println(<FONT color=#f800f8>&quot;</FONT><FONT color=#6858c8>\n</FONT><FONT color=#f800f8>Integers sorted List ...&quot;</FONT>);        <B><FONT color=#a02828>for</FONT></B> (<B><FONT color=#288850>int</FONT></B> i = <FONT color=#f800f8>0</FONT>; i &lt; in.length; i++) {            System.out.println((Integer)l.get(i));        }    }    <FONT color=#0000f8>/**</FONT><FONT color=#0000f8>     *</FONT><FONT color=#6858c8> put your documentation comment here</FONT><FONT color=#0000f8>     *</FONT><FONT color=#6858c8> </FONT><FONT color=#6858c8>@param</FONT><FONT color=#008888> o[]</FONT><FONT color=#0000f8>     * </FONT><FONT color=#6858c8>@return</FONT><FONT color=#0000f8> </FONT><FONT color=#0000f8>     */</FONT>    <B><FONT color=#288850>public</FONT></B> <B><FONT color=#288850>static</FONT></B> List sort (Object o[]) {        ArrayList al = <B><FONT color=#a02828>new</FONT></B> ArrayList();        <B><FONT color=#a02828>for</FONT></B> (<B><FONT color=#288850>int</FONT></B> i = <FONT color=#f800f8>0</FONT>; i &lt; o.length; i++)            al.add(i, o[i]);        List list = Collections.synchronizedList(al);        Collections.sort(list);        <B><FONT color=#a02828>return</FONT></B>  list;    }}</PRE></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -