📄 实用工具和旧版本类.txt
字号:
实用工具和旧版本类 List.1 Collections.txt
实用工具和旧版本类 List.2 BitSet.txt
实用工具和旧版本类 List.3 BitSetDemo/BitSetDemo.java
--------------------------------------------------------------------------------
实用工具和旧版本类 List.1 Collections.txt
Return to top
001: // Sorting and searching methods
002: public static void sort(List list);
003: public static void sort(List list, Comparator c);
004: public static int binarySearch(List list, Object key);
005: public static int binarySearch(List list, Object key, Comparator c);
006:
007: // Unmodifiable wrappers
008: public static Collection unmodifiableCollection(Collection c);
009: public static Set unmodifiableSet(Set s);
010: public static SortedSet unmodifiableSortedSet(SortedSet s);
011: public static List unmodifiableList(List list);
012: public static Map unmodifiableMap(Map m);
013: public static SortedMap unmodifiableSortedMap(SortedMap m);
014:
015: // Synchronized wrappers
016: public static Collection synchronizedCollection(Collection c);
017: public static Set synchronizedSet(Set s);
018: public static SortedSet synchronizedSortedSet(SortedSet s);
019: public static List synchronizedList(List list);
020: public static Map synchronizedMap(Map m);
021: public static SortedMap synchronizedSortedMap(SortedMap m);
022:
023: // Miscellaneous operations
024: public static void reverse(List l);
025: public static void shuffle(List list);
026: public static void shuffle(List list, Random rnd);
027: public static void fill(List list, Object o);
028: public static void copy (List dest, List src);
029: public static Object min(Collection coll);
030: public static Object min(Collection coll, Comparator comp);
031: public static Object max(Collection coll);
032: public static Object max(Collection coll, Comparator comp);
033:
034: // Other declarations
035: public static final Set EMPTY_SET;
036: public static final List EMPTY_LIST;
037: public static final Map EMPTY_MAP;
038: public static Set singleton(Object o);
039: public static List singletonList(Object o);
040: public static Map singletonMap(Object key, Object value);
041: public static List nCopies(int n, Object o);
042: public static Comparator reverseOrder();
043: public static Enumeration enumeration(final Collection c);
Return to top
--------------------------------------------------------------------------------
实用工具和旧版本类 List.2 BitSet.txt
Return to top
001: // BitSet constructors
002: public BitSet();
003: public BitSet(int nbits);
004:
005: // BitSet methods
006: public int length();
007: public void set(int bitIndex);
008: public void clear(int bitIndex);
009: public void andNot(BitSet set);
010: public boolean get(int bitIndex);
011: public void and(BitSet set);
012: public void or(BitSet set);
013: public void xor(BitSet set);
014: public int hashCode();
015: public int size();
016: public boolean equals(Object obj);
017: public Object clone();
018: public String toString();
Return to top
--------------------------------------------------------------------------------
实用工具和旧版本类 List.3 BitSetDemo/BitSetDemo.java
Return to top
001: import java.util.BitSet;
002:
003: class BitSetDemo {
004: // Display string and value of BitSet object
005: public static void show(String s, BitSet obj) {
006: System.out.println(s + obj.toString());
007: }
008: // Main program tests BitSet Boolean logic
009: public static void main(String args[]) {
010: // Construct two BitSets
011: BitSet set1 = new BitSet(16);
012: BitSet set2 = new BitSet(16);
013: // Set bits 2, 4, and 8 in set 1
014: set1.set(2); set1.set(4); set1.set(8);
015: // Set all bits in set 2
016: for (int i = 0; i < set2.size(); i++)
017: set2.set(i);
018: // Test Boolean logic and show results
019: show("before XOR set1 = ", set1);
020: set1.xor(set2);
021: show("after XOR set1 = ", set1);
022: set1.xor(set2);
023: show("after XOR set1 = ", set1);
024: }
025: }
Return to top
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -