java¶ÓÁÐ
¶ÓÁÐÊÇÉè¼Æ³ÌÐòÖг£ÓõÄÒ»ÖÖÊý¾Ý½á¹¹¡£ËüÀàËÆÈÕ³£Éú»îÖеÄÅŶÓÏÖÏ󣬲ÉÓÃÒ»ÖÖ±»³ÆΪ
“ÏȽøÏȳö”(FIFO)µÄ´æ´¢½á¹¹¡£Êý¾ÝÔªËØÖ»ÄÜ´Ó¶Óβ½øÈ룬´Ó¶ÓÊ×È¡³ö¡£ÔÚ¶ÓÁÐÖУ¬
Êý¾ÝÔªËØ¿ÉÒÔÈÎÒâÔö¼õ£¬µ«Êý¾ÝÔªËصĴÎÐò²»»á¸Ä±ä¡£Ã¿µ±ÓÐÊý¾ÝÔªËØ´Ó¶ÓÁÐÖб»È¡³ö£¬
ºóÃæµÄÊý¾ÝÔªËØÒÀ´ÎÏòÇ°Òƶ¯Ò»Î»¡£ËùÒÔ£¬ÈκÎʱºò´Ó¶ÓÁÐÖжÁµ½µÄ¶¼ÊǶÓÊ×µÄÊý¾Ý¡£
¸ù¾ÝÕâЩÌص㣬¶Ô¶ÓÁж¨ÒåÁËÒÔÏÂÁùÖÖ²Ù×÷£º
enq(x) Ïò¶ÓÁвåÈëÒ»¸öֵΪxµÄÔªËØ£»
deq() ´Ó¶ÓÁÐɾ³ýÒ»¸öÔªËØ£»
front() ´Ó¶ÓÁÐÖжÁÒ»¸öÔªËØ£¬µ«¶ÓÁб£³Ö²»±ä£»
empty() Åж϶ÓÁÐÊÇ·ñΪ¿Õ£¬¿ÕÔò·µ»ØÕ棻
clear() Çå¿Õ¶ÓÁУ»
search(x) ²éÕÒ¾à¶ÓÊ××î½üµÄÔªËصÄλÖã¬Èô²»´æÔÚ£¬·µ»Ø-1¡£
VectorÀàÊÇJAVAÖÐרߺÔð´¦Àí¶ÔÏóÔªËØÓÐÐò´æ´¢ºÍÈÎÒâÔöɾµÄÀ࣬Òò´Ë£¬ÓÃVector
¿ÉÒÔ¿ìËÙʵÏÖJAVAµÄ¶ÓÁÐÀà¡£
public class Queue extends java
public synchronized void enq(Object x) {
super.addElement(x);
}
public synchronized Object deq() {
/* ¶ÓÁÐÈôΪ¿Õ£¬Òý·¢EmptyQueueExceptionÒì³£ */
if( this.empty() )
throw new EmptyQueueException();
Object x = super.elementAt(0);
super.removeElementAt(0);
return x;
}
public synchronized Object front() {
if( this.empty() )
throw new EmptyQueueException();
return super.elementAt(0);
}
public boolean empty() {
return super.isEmpty();
}
public synchronized void clear() {
super.removeAllElements();
}
public int search(Object x) {
return super.indexOf(x);
}
}
public class EmptyQueueException extends java
}
Ïà¹ØÎĵµ£º
Èý¸öѧÉúµ½Ò»¸öË®ÁúÍ·ÏÂÅŶÓÈ¡Ë®£¬ÈýÈ˶¼È¡ÍêË®ºóÒ»ÆðÀ뿪¡£
ÕâÀïÉæ¼°µ½ÈçºÎÅжÏÈý¸öÈ˶¼È¡ÍêË®¡£Èç¹ûÓÃÆÕͨµÄ¾²Ì¬³ÉÔ±£¬ÊƱػáÒªÓÃÎÞÏÞÑ»·À´µÈ´ý¡£¸üºÃµÄ°ì·¨ÊÇÓà wait-notify »úÖÆ¡£Ç°Á½¸öѧÉúÈ¡ÍêË®ºó¶¼ wait£¬×îºóÒ»¸öѧÉúÈ¡ÍêË®ºó notify£¬ÕâÑù¾ÍÄÜÒ»ÆðÀ뿪ÁË¡£ÏÂÃæÊÇ´úÂëʾÀý£º
/**
* Èý¸öѧÉúÅŶÓÈ¡Ë®£¬È¡ÍêºóÒ ......
¶ÔÓÚ³õѧÕߣ¬Ò²Ðдó¼Ò»áÈÏΪJava°üº¬JavaScript£¬È»¶øÕâÖÖ´Ó×ÖÃæÒâ˼µÄÀí½âÊÇ´íÎóµÄ£¬ÏÂÃæС±àdz̸һÏÂJavaScriptÓëjavaµÄÇø±ð¡£
1. »ùÓÚ¶ÔÏóºÍÃæÏò¶ÔÏó
JavaÊÇÒ»ÖÖÕæÕýµÄÃæÏò¶ÔÏóµÄÓïÑÔ£¬¼´Ê¹ÊÇ¿ª·¢¼òµ¥µÄ³ÌÐò£¬±ØÐëÉè¼Æ¶ÔÏó¡£
JavaScriptÊÇÖֽű¾ÓïÑÔ£¬Ëü¿ÉÒÔÓÃÀ´ÖÆ×÷ÓëÍøÂçÎ޹صģ¬ÓëÓû§½»»¥×÷Óõĸ´ÔÓÈí¼þ¡£ ......
from: http://mmblue.javaeye.com/blog/511915
package org.mmblue.common.util;
import java.util.List;
public class PageModel<T> {
// ......
Ò»¡¢Java»ù´¡ÖªÊ¶
1.JavaÓÐÄÇЩ»ù±¾Êý¾ÝÀàÐÍ£¬StringÊDz»ÊÇ»ù±¾Êý¾ÝÀàÐÍ£¬ËûÃÇÓкÎÇø±ð¡£
2.×Ö·û´®µÄ²Ù×÷£º
дһ¸ö·½·¨£¬ÊµÏÖ×Ö·û´®µÄ·´×ª£¬È磺ÊäÈëabc£¬Êä³öcba
дһ¸ö·½·¨£¬ÊµÏÖ×Ö·û´®µÄÌæ»»£¬È磺ÊäÈëbbbwlirbbb£¬Êä³öbbbhhtccc¡£
3.Êý¾ÝÀàÐÍÖ®¼äµÄת»»
ÈçºÎ½«ÊýÖµÐÍ×Ö·ûת»»ÎªÊý×Ö£¨ ......
Ê®½øÖÆת³ÉÊ®Áù½øÖÆ£º
Integer.toHexString(int i)
Ê®½øÖÆת³É°Ë½øÖÆ
Integer.toOctalString(int i)
Ê®½øÖÆת³É¶þ½øÖÆ
Integer.toBinaryString(int i)
Ê®Áù½øÖÆת³ÉÊ®½øÖÆ
Integer.valueOf("FFFF",16).toString()
°Ë½øÖÆת³ÉÊ®½øÖÆ
Integer.valueOf("876",8).toString()
¶þ½øÖÆתʮ½øÖÆ
Intege ......