Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java£ºArrayListÑ­»·±éÀúµÄÁ©ÖÖ·½·¨Ê¹ÓÃ

package collection;
import java.util.*;
public class NewArrayList {
 public static void main(String[] args) {
  List<Student> students = new ArrayList<Student>();
  for (int i = 0; i < 6; i++) {
   students.add(new Student("Happy"+i,"male"+i,20+i));
  }
  print(students);
  print2(students);
 }
 
 //Ñ­»·±éÀú¢Ùfor
 public static void print(List<Student> newList){
  System.out.println("×ÜÊý¾Ý£º"+newList.size());
  Student student;
  for (int i = 0; i < newList.size(); i++) {
   student = (Student)newList.get(i);
   System.out.println(student.toString());
  }
 }
 //Ñ­»·±éÀú¢ÙIterator
 public static void print2(List<Student> newList){
  System.out.println("×ÜÊý¾Ý£º"+newList.size());
  Iterator<Student> iterator = newList.iterator();
  Student student;
  while (iterator.hasNext()){
   student = (Student)iterator.next();
   System.out.println(student.toString());
  }
 }
 
}


Ïà¹ØÎĵµ£º

Java´®¿Ú±à³Ì1

    ¹«Ë¾Óõ½´®¿Ú±à³Ì£¬¹Ê¿ªÊ¼Ñо¿£¬Ê×ÏÈËѵ½µÄÊÇjavacomm20-win32.zipÕâ¸öѹËõ°ü£¬°´ÕÕÍøÉϵݲװÅäÖúã¬ÈçÏ£º
    API
    ÔÚjavax.commÏÂÓÐ13¸öÀàºÍ½Ó¿Ú£¬·Ö±ðÊÇ
    4¸ö½Ó¿Ú
    CommDriver ¿É¸ºÔØÉ豸£¨the loadable device£©Çý¶¯³ ......

java ¸ù¾ÝÁ½µã¾­Î³¶ÈÀ´Ëã¾àÀë

package com.njty.util;
public class Test {
  private static final double EARTH_RADIUS = 6378137;
  private static double rad(double d)
     {
        return d * Math.PI / 180.0;
     }
     ......

java£º¶þ·Ö²éÕÒ·¨

package arrays.compara;
/**
 *
 * @author Happy ¶þ·Ö²éÕÒ·¨
 */
public class BinarySearch {
 public static void main(String[] args) {
  int[] arrInt = { 2, 34, 32, 24, 23, 34, 12, 3, 4, 2 };
  int index = bSearch(29, arrInt, 0, arrInt.length);
 & ......

java£ºÊÖдMyArrayLisyµÄ³£Ó÷½·¨£¬Ôöɾ¸Ä²é

package arrays.myArray;
public class MyArrayList {
 private Object[] arrObj = new Object[3];
 private int size = 0;
 
 // ³¤¶È
 public int size() {
  return size;
 }
 // insert
 public void add(Object obj) {
  add(size,obj);
&nb ......

java£ºÊÖдMyLinkedListËùÓз½·¨£¬Ôöɾ¸Ä²é

package arrays.myArray;
public class MyLinkedList {
 private int size = 0;
 private Node1 head = null;
 // Ìí¼Ó
 public void add(Object obj) {
  add(size, obj);
 }
 // ÐÞ¸Ä
 public void add(int index, Object obj) {
  if (null == head) ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ