コード例 #1
0
 public static void main(String[] args) {
   CompType[] a = Generated.array(new CompType[12], CompType.generator());
   print("before sorting:");
   print(Arrays.toString(a));
   Arrays.sort(a, new CompTypeComparator());
   print("after sorting:");
   print(Arrays.toString(a));
 }
コード例 #2
0
ファイル: Tester.java プロジェクト: x7chen/ThinkInJavaCode
 Tester(String testId, int nReaders, int nWriters) {
   this.testId = testId + " " + nReaders + "r " + nWriters + "w";
   this.nReaders = nReaders;
   this.nWriters = nWriters;
   writeData = Generated.array(Integer.class, new RandomGenerator.Integer(), containerSize);
   for (int i = 0; i < testReps; i++) {
     runTest();
     readTime = 0;
     writeTime = 0;
   }
 }
コード例 #3
0
ファイル: e12.java プロジェクト: PavelKostenko/Arrays_ex
 public static void main(String[] args) {
   double[] dArray = new double[3];
   net.mindview.util.CountingGenerator.Double dl =
       new net.mindview.util.CountingGenerator.Double();
   for (int i = 0; i < 3; i++) {
     dArray[i] = dl.next();
   }
   System.out.println(Arrays.toString(dArray));
   // OR
   double[] dArray2 =
       ConvertTo.primitive(Generated.array(Double.class, new CountingGenerator.Double(), 5));
   System.out.println(Arrays.toString(dArray2));
 }
コード例 #4
0
 public static void main(String[] args) {
   double[] doubles =
       ConvertTo.primitive(Generated.array(Double.class, new CountingGenerator.Double(), 10));
   print(Arrays.toString(doubles));
 }