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

Java ÖжÓÁеÄʹÓÃ

¸Õ²Å¿´¼ûȺÀïµÄÒ»¸öÅóÓÑÔÚÎʶÓÁеÄʹÓã¬È·ÊµÔÚÏÖʵµÄд´úÂëÖкÜÉÙʹÓöÓÁеģ¬·´ÕýÎÒÊÇ´ÓÀ´Ã»Ê¹Óùý¡£Ö»ÊÇѧÊý¾Ý½á¹¹µÄʱºòѧ¹ý¡£
ÏÂÃæÊÇÎÒдµÄÒ»¸öСÀý×Ó£¬Ï£ÍûÓв»×ãÖ®´¦ÇëÌá³ö¸ÄÕý¡£O(∩_∩)O~
¿´´úÂ룺
import java.util.LinkedList;
import java.util.Queue;
public class TestQueue
{
/**
* @param args
* @author JavaAlpha
* Info ²âÊÔ¶ÓÁÐ
*/
public static void main(String[] args)
{
Queue<String> queue = new LinkedList<String>();
queue.offer("1");//²åÈëÒ»¸öÔªËØ
queue.offer("2");
queue.offer("3");
//´òÓ¡ÔªËظöÊý
System.out.println("queue.size()"+queue.size());
//±éÀú´òÓ¡ËùÓеÄÔªËØ,°²×°²åÈëÊÇ˳Ðò´òÓ¡
for (String string : queue)
{
System.out.println(string);
}
}
}
´òÓ¡ÄÚÈÝ£º
queue.size()3
1
2
3
ÏÂÃæÊÇAPIÖжԶÓÁеÄ˵Ã÷£º
public interface Queue<E>extends Collection<E>
ÔÚ´¦ÀíÔªËØÇ°ÓÃÓÚ±£´æÔªËØµÄ collection¡£³ýÁË»ù±¾µÄ Collection ²Ù×÷Í⣬¶ÓÁл¹ÌṩÆäËûµÄ²åÈë¡¢ÌáÈ¡ºÍ¼ì²é²Ù×÷¡£Ã¿¸ö·½·¨¶¼´æÔÚÁ½ÖÖÐÎʽ£ºÒ»ÖÖÅ׳öÒì³££¨²Ù×÷ʧ°Üʱ£©£¬ÁíÒ»ÖÖ·µ»ØÒ»¸öÌØÊâÖµ£¨null »ò false£¬¾ßÌåÈ¡¾öÓÚ²Ù×÷£©¡£²åÈë²Ù×÷µÄºóÒ»ÖÖÐÎʽÊÇÓÃÓÚרÃÅΪÓÐÈÝÁ¿ÏÞÖÆµÄ Queue ʵÏÖÉè¼ÆµÄ£»ÔÚ´ó¶àÊýʵÏÖÖУ¬²åÈë²Ù×÷²»»áʧ°Ü¡£
 
Å׳öÒì³£
·µ»ØÌØÊâÖµ
²åÈë
add(e)
offer(e)
ÒƳý
remove()
poll()
¼ì²é
element()
peek()
¶ÓÁÐͨ³££¨µ«²¢·ÇÒ»¶¨£©ÒÔ FIFO£¨ÏȽøÏȳö£©µÄ·½Ê½ÅÅÐò¸÷¸öÔªËØ¡£²»¹ýÓÅÏȼ¶¶ÓÁÐºÍ LIFO ¶ÓÁУ¨»ò¶ÑÕ»£©ÀýÍ⣬ǰÕ߸ù¾ÝÌṩµÄ±È½ÏÆ÷»òÔªËصÄ×ÔȻ˳Ðò¶ÔÔªËؽøÐÐÅÅÐò£¬ºóÕß°´ LIFO£¨ºó½øÏȳö£©µÄ·½Ê½¶ÔÔªËؽøÐÐÅÅÐò¡£ÎÞÂÛʹÓÃÄÄÖÖÅÅÐò·½Ê½£¬¶ÓÁеÄÍ· ¶¼Êǵ÷Óà remove() »ò poll() ËùÒƳýµÄÔªËØ¡£ÔÚ FIFO ¶ÓÁÐÖУ¬ËùÓеÄÐÂÔªËض¼²åÈë¶ÓÁеÄĩβ¡£ÆäËûÖÖÀàµÄ¶ÓÁпÉÄÜʹÓò»Í¬µÄÔªËØ·ÅÖùæÔò¡£Ã¿¸ö Queue ʵÏÖ±ØÐëÖ¸¶¨Æä˳ÐòÊôÐÔ¡£
Èç¹û¿ÉÄÜ£¬offer ·½·¨¿É²åÈëÒ»¸öÔªËØ£¬·ñÔò·µ»Ø false¡£ÕâÓë Collection.add ·½·¨²»Í¬£¬¸Ã·½·¨Ö»ÄÜͨ¹ýÅ׳öδ¾­¼ì²éµÄÒ쳣ʹÌí¼ÓÔªËØʧ°Ü¡£offer ·½·¨Éè¼ÆÓÃÓÚÕý³£µÄʧ°ÜÇé¿ö£¬¶ø²»ÊdzöÏÖÒì³£µÄÇé¿ö£¬ÀýÈçÔÚÈÝÁ¿¹Ì¶¨£¨Óн磩µÄ¶ÓÁÐÖС£
remove() ºÍ poll() ·½·¨¿ÉÒƳýºÍ·µ»Ø¶ÓÁеÄÍ·¡£µ½µ×´Ó¶ÓÁÐÖÐÒƳýÄĸöÔªËØÊǶÓÁÐÅÅÐò²ßÂԵŦÄÜ£¬¶ø¸Ã²ßÂÔÔÚ¸÷ÖÖÊ


Ïà¹ØÎĵµ£º

java ftpÉÏ´«ºÍÏÂÔØ

Ê×ÏÈ£¬½¨3¸ö½Ó¿Ú
FTPOperate.java:
public interface FTPOperate
{
public void execute(FTPBean entity);
}

FTPProxy.java:
public interface FTPProxy
{
public void connection();
public abstract void upload();

public abstract void download();
public void setEntity(FTPBe ......

JavaÓïÑÔÊä³ö¾Å¾Å³Ë·¨±í

public class Multiplication
{
      public static void main(String[] args)
     {
          // TODO Auto-generated method stub
          for(int i = 1; i < 10; i+ ......

javaÀûÓÃSocketÍøÂç´«µÝÎļþ

·þÎñÆ÷¶Ë:
package com.huahua;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
public class ServerThread extends Thread {
......

java³ÌÐòÔ±Ó¦¸Ã¾­³£ä¯ÀÀµÄÍøÕ¾£¨¾­µäÍƼö£¬¸öÈËÊղأ©

ÍøÕ¾ÁбíÈçÏ£º
 
IBMÖйúµÄ¿ª·¢ÕßÍøÕ¾£ºhttp://www.ibm.com/developerworks/cn/
 
IBMÖйúfor javaµÄ¿ª·¢ÕßÍøÕ¾£ºhttp://www.ibm.com/developerworks/cn/java/  ÖÐÎÄ
 
IBMÖйúfor javaµÄ¿ª·¢ÕßÍøÕ¾£ºhttp://www.ibm.com/developerworks/java  Ó¢ÎÄ
 
Google´úÂëĿ¼ÍøÕ¾£ºhttp://c ......

ÔÚJava web·þÎñÆ÷ÄÚʹÓÃurl rewrite

ÿ¸öÍøÒ³»òÇëÇó¶¼ÊÇÒ»¸öurlµØÖ·£¬Ò»°ã£¬Õâ¸öµØÖ·¿ÉÄÜÊÇ.do,.page,.actionÖ®ÀàµÄ²¢¼ÓÉÏ'?'ºÅ¡¢'&'ºÅ²éѯ´®µÈ¹¹³ÉµÄÒ»¸ö³¤³¤µÄµÄurl¡£ºÜurgly¡£
Ò»°ãµÄurl----------------------------------------------------------½ÏºÃµÄurl
http://www.xxx.net/user/profile.do?id=20001   ====> http://www.xxx.ne ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ