/** * Creates a new, empty {@code DefaultPair} with both values being null. * * @param <FirstType> * Type of the first object in the pair. * @param <SecondType> * Type of the second object in the pair. * @return * A new, empty {@code DefaultPair}. */ public static <FirstType, SecondType> DefaultPair<FirstType, SecondType> create() { return new DefaultPair<FirstType, SecondType>(); }
/** * Computes the minimum and maximum of a set of data in a single pass. * @param data * Data to consider * @return * Minimum and Maximum */ public static Pair<Double,Double> computeMinAndMax( Iterable<? extends Number> data ) { double min = Double.POSITIVE_INFINITY; double max = Double.NEGATIVE_INFINITY; for( Number value : data ) { double x = value.doubleValue(); if( min > x ) { min = x; } if( max < x ) { max = x; } } return DefaultPair.create( min, max ); }
new DefaultPair<ArrayList<StatisticType>, ArrayList<StatisticType>>( new ArrayList<StatisticType>(folds.size()), new ArrayList<StatisticType>(folds.size()))); this.getStatistics().getFirst(), this.getStatistics().getSecond())); this.getStatistics().getFirst()); final SummaryType summary2 = this.getSummarizer().summarize( this.getStatistics().getSecond()); new DefaultPair<SummaryType, SummaryType>(summary1, summary2));
@Override @SuppressWarnings("unchecked") public boolean equals( final Object other) { return other instanceof Pair && this.equals((Pair<FirstType, SecondType>) other); }
/** * Returns an ArrayList of field/value pairs * @param o * Object to get the field/value pairs * @return * ArrayList of field/value pairs. The value component of the DefaultPair will * be null if the field is protected by the security manager */ public static ArrayList<DefaultPair<Field,Object>> getAllFieldValues( final Object o ) { LinkedList<Field> fields = ObjectUtil.getAllFields( o.getClass() ); ArrayList<Object> values = ObjectUtil.getFieldValues( o, fields ); return DefaultPair.mergeCollections( fields, values ); }
new DefaultPair<ArrayList<StatisticType>, ArrayList<StatisticType>>( new ArrayList<StatisticType>(folds.size()), new ArrayList<StatisticType>(folds.size()))); this.getStatistics().getFirst(), this.getStatistics().getSecond())); this.getStatistics().getFirst()); final SummaryType summary2 = this.getSummarizer().summarize( this.getStatistics().getSecond()); new DefaultPair<SummaryType, SummaryType>(summary1, summary2));
@Override @SuppressWarnings("unchecked") public boolean equals( final Object other) { return other instanceof Pair && this.equals((Pair<FirstType, SecondType>) other); }
/** * Returns an ArrayList of field/value pairs * @param o * Object to get the field/value pairs * @return * ArrayList of field/value pairs. The value component of the DefaultPair will * be null if the field is protected by the security manager */ public static ArrayList<DefaultPair<Field,Object>> getAllFieldValues( final Object o ) { LinkedList<Field> fields = ObjectUtil.getAllFields( o.getClass() ); ArrayList<Object> values = ObjectUtil.getFieldValues( o, fields ); return DefaultPair.mergeCollections( fields, values ); }
/** * Creates a new, empty {@code DefaultPair} with both values being null. * * @param <FirstType> * Type of the first object in the pair. * @param <SecondType> * Type of the second object in the pair. * @return * A new, empty {@code DefaultPair}. */ public static <FirstType, SecondType> DefaultPair<FirstType, SecondType> create() { return new DefaultPair<FirstType, SecondType>(); }
new DefaultPair<ArrayList<StatisticType>, ArrayList<StatisticType>>( new ArrayList<StatisticType>(folds.size()), new ArrayList<StatisticType>(folds.size()))); this.getStatistics().getFirst(), this.getStatistics().getSecond())); this.getStatistics().getFirst()); final SummaryType summary2 = this.getSummarizer().summarize( this.getStatistics().getSecond()); new DefaultPair<SummaryType, SummaryType>(summary1, summary2));
/** * Computes the minimum and maximum of a set of data in a single pass. * @param data * Data to consider * @return * Minimum and Maximum */ public static Pair<Double,Double> computeMinAndMax( Iterable<? extends Number> data ) { double min = Double.POSITIVE_INFINITY; double max = Double.NEGATIVE_INFINITY; for( Number value : data ) { double x = value.doubleValue(); if( min > x ) { min = x; } if( max < x ) { max = x; } } return DefaultPair.create( min, max ); }
@Override @SuppressWarnings("unchecked") public boolean equals( final Object other) { return other instanceof Pair && this.equals((Pair<FirstType, SecondType>) other); }
/** * Returns an ArrayList of field/value pairs * @param o * Object to get the field/value pairs * @return * ArrayList of field/value pairs. The value component of the DefaultPair will * be null if the field is protected by the security manager */ public static ArrayList<DefaultPair<Field,Object>> getAllFieldValues( final Object o ) { LinkedList<Field> fields = ObjectUtil.getAllFields( o.getClass() ); ArrayList<Object> values = ObjectUtil.getFieldValues( o, fields ); return DefaultPair.mergeCollections( fields, values ); }
/** * Creates a new, empty {@code DefaultPair} with both values being null. * * @param <FirstType> * Type of the first object in the pair. * @param <SecondType> * Type of the second object in the pair. * @return * A new, empty {@code DefaultPair}. */ public static <FirstType, SecondType> DefaultPair<FirstType, SecondType> create() { return new DefaultPair<FirstType, SecondType>(); }