枚舉(Enumeration)
枚舉(Enumeration)接口雖然它本身不屬于數據結構,但它在其他數據結構的范疇里應用很廣。 枚舉(The Enumeration)接口定義了一種從數據結構中取回連續元素的方式。
while (days.hasMoreElements())
{?
System.out.println(days.nextElement());?
}
位集合(BitSet)
位集合類實現了一組可以單獨設置和清除的位或標志。
該類在處理一組布爾值的時候非常有用,你只需要給每個值賦值一"位",然后對位進行適當的設置或清除,就可以對布爾值進行操作了。
BitSet();
序號
? ??
方法描述
1
? ??
void and(BitSet set)
對此目標位 set 和參數位 set 執行邏輯與操作。
2
? ??
void andNot(BitSet set)
清除此 BitSet 中所有的位,其相應的位在指定的 BitSet 中已設置。
3
? ??
int cardinality( )
返回此 BitSet 中設置為 true 的位數。
4
? ??
void clear( )
將此 BitSet 中的所有位設置為 false。
5
? ??
void clear(int index)
將索引指定處的位設置為 false。
6
? ??
void clear(int startIndex, int endIndex)
將指定的 startIndex(包括)到指定的 toIndex(不包括)范圍內的位設置為 false。
7
? ??
Object clone( )
復制此 BitSet,生成一個與之相等的新 BitSet。
8
? ??
boolean equals(Object bitSet)
將此對象與指定的對象進行比較。
9
? ??
void flip(int index)
將指定索引處的位設置為其當前值的補碼。
10
? ??
void flip(int startIndex, int endIndex)
將指定的 fromIndex(包括)到指定的 toIndex(不包括)范圍內的每個位設置為其當前值的補碼。
11
? ??
boolean get(int index)
返回指定索引處的位值。
12
? ??
BitSet get(int startIndex, int endIndex)
返回一個新的 BitSet,它由此 BitSet 中從 fromIndex(包括)到 toIndex(不包括)范圍內的位組成。
13
? ??
int hashCode( )
返回此位 set 的哈希碼值。
14
? ??
boolean intersects(BitSet bitSet)
如果指定的 BitSet 中有設置為 true 的位,并且在此 BitSet 中也將其設置為 true,則返回 true。
15
? ??
boolean isEmpty( )
如果此 BitSet 中沒有包含任何設置為 true 的位,則返回 true。
16
? ??
int length( )
返回此 BitSet 的"邏輯大小":BitSet 中最高設置位的索引加 1。
17
? ??
int nextClearBit(int startIndex)
返回第一個設置為 false 的位的索引,這發生在指定的起始索引或之后的索引上。
18
? ??
int nextSetBit(int startIndex)
返回第一個設置為 true 的位的索引,這發生在指定的起始索引或之后的索引上。
19
? ??
void or(BitSet bitSet)
對此位 set 和位 set 參數執行邏輯或操作。
20
? ??
void set(int index)
將指定索引處的位設置為 true。
21
? ??
void set(int index, boolean v)
?將指定索引處的位設置為指定的值。
22
? ??
void set(int startIndex, int endIndex)
將指定的 fromIndex(包括)到指定的 toIndex(不包括)范圍內的位設置為 true。
23
? ??
void set(int startIndex, int endIndex, boolean v)
將指定的 fromIndex(包括)到指定的 toIndex(不包括)范圍內的位設置為指定的值。
24
? ??
int size( )
返回此 BitSet 表示位值時實際使用空間的位數。
25
? ??
String toString( )
返回此位 set 的字符串表示形式。
26
? ??
void xor(BitSet bitSet)
對此位 set 和位 set 參數執行邏輯異或操作。