|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
j2EE和asp比较,其实也没什么比的,原因和我上面说那些比较差不了多少,也是稳定性,安全性,J2EE比asp高,速度上比不过asp,asp也是延续着它的拖拽控件的方法,提高速度。delphi的StringList类真好用啊试着用java写了一个
packagecom.zhao_yi.sysutils.classes;
importjava.util.List;
importjava.util.ArrayList;
importjava.util.StringTokenizer;
importcom.zhao_yi.sysutils.SysUtil;
importcom.zhao_yi.sysutils.*;
importjava.util.Arrays;
importjava.util.*;
publicclassStringList{
privateListstrings=newArrayList();
privateListobjects=newArrayList();
privatebooleansorted=false;
publicStringList(){
}
publicString[]getStrings(){
return(String[])strings.toArray(newString[strings.size()]);
}
publicvoidsetStrings(String[]array){
strings=null;objects=null;
strings=newArrayList(Arrays.asList(array));
objects=newArrayList(array.length);
}
privatevoidrangeCheck(intIndex)throwsIndexOutOfBoundsException{
if((Index<0)||(Index>=getCount()))
thrownewIndexOutOfBoundsException();
}
publicintgetCount(){
returnstrings.size();
}
publicStringGet(intIndex){
return(String)strings.get(Index);
}
publicintFind(StringS){
intI,L,H,C;
L=0;
H=getCount()-1;
while(L<=H){
I=(L+H)/2;
C=SysUtil.CompareStrings(Get(I),S);
if(C<0)
L=I+1;
else{
H=I-1;
if(C==0)
L=I;
}
}
returnL;
}
publicintAddObject(StringS,ObjectAObject){
intResult=-1;
if(!sorted)
Result=getCount();
else
Result=Find(S);
InsertItem(Result,S,AObject);
returnResult;
}
publicintAdd(StringS){
returnAddObject(S,null);
}
publicvoidAddStrings(StringListStrings){
for(inti=0;i<Strings.getCount();i++)
Add(Strings.Get(i));
}
publicvoidAddStrings(String[]Strings){
for(inti=0;i<Strings.length;i++)
Add(Strings[i]);
}
publicvoidClear(){
strings.clear();
objects.clear();
}
publicvoidDelete(intIndex){
strings.remove(Index);
objects.remove(Index);
}
publicvoidInsertItem(intIndex,StringS,ObjectAObject){
strings.add(Index,S);
objects.add(Index,AObject);
}
publicvoidPut(intIndex,StringS)throwsIllegalStateException{
if(this.sorted)
thrownewIllegalStateException("listsorted!");
else
strings.set(Index,S);
}
publicvoidPutObject(intIndex,ObjectAObject){
objects.set(Index,AObject);
}
publicvoidExchange(intIndex1,intIndex2){
Objecttemp=null;
temp=strings.get(Index1);
strings.set(Index1,strings.get(Index2));
strings.set(Index2,temp);
temp=objects.get(Index1);
objects.set(Index1,objects.get(Index2));
objects.set(Index2,temp);
}
publicvoidQuickSort(intL,intR){
if(L<R){
inti=L;
intj=R;
StringS=Get(L);
while(i<j){
while(SysUtil.CompareStrings(Get(i),S)<=0)
i++;
while(SysUtil.CompareStrings(Get(j),S)>0)
j--;
if(i<j)
Exchange(i,j);
}
Exchange(i,L);
if(L<j)
QuickSort(L,j);
if(i<R)
QuickSort(i,R);
}
}
publicvoidSetSorted(booleanvalue){
if(value!=sorted){
if(value)
QuickSort(0,getCount()-1);
sorted=value;
}
}
publicintIndexOf(StringS){
returnstrings.indexOf(S);
}
publicStringgetTextStr(){
StringBufferResult=newStringBuffer();
for(inti=0;i<strings.size();i++){
Result.append(Get(i));
Result.append(Systems.lineseparator);
}
returnResult.toString();
}
publicvoidsetTextStr(Stringvalue){
Clear();
StringTokenizertokenizer=newStringTokenizer(value,Systems.lineseparator);
while(tokenizer.hasMoreTokens())
Add(tokenizer.nextToken());
}
}
Java伴随着互联网的迅猛发展而发展,逐渐成为重要的网络编程语言。Oracle收购Sun后Java前途未卜。 |
|