Example usage for java.lang Integer intValue

List of usage examples for java.lang Integer intValue

Introduction

In this page you can find the example usage for java.lang Integer intValue.

Prototype

@HotSpotIntrinsicCandidate
public int intValue() 

Source Link

Document

Returns the value of this Integer as an int .

Usage

From source file:Main.java

/**
 * Returns a {@link Map} mapping each unique element in the given
 * {@link Collection} to an {@link Integer} representing the number
 * of occurrences of that element in the {@link Collection}.
 * <p>//from   w w w . jav a2 s  .  c  om
 * Only those elements present in the collection will appear as
 * keys in the map.
 *
 * @param coll  the collection to get the cardinality map for, must not be null
 * @return the populated cardinality map
 */
public static Map getCardinalityMap(final Collection coll) {
    Map count = new HashMap();
    for (Iterator it = coll.iterator(); it.hasNext();) {
        Object obj = it.next();
        Integer c = (Integer) (count.get(obj));
        if (c == null) {
            count.put(obj, INTEGER_ONE);
        } else {
            count.put(obj, new Integer(c.intValue() + 1));
        }
    }
    return count;
}

From source file:com.openappengine.utility.ObjectConverter.java

/**
 * Converts Integer to Boolean. If integer value is 0, then return FALSE, else return TRUE.
 * @param value The Integer to be converted.
 * @return The converted Boolean value./*from w ww.j a v a 2s  .  com*/
 */
public static Boolean integerToBoolean(Integer value) {
    return value.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE;
}

From source file:com.formkiq.core.webflow.FlowManager.java

/**
 * Get Event Id.//  w  ww. j  a v  a 2  s. c  o m
 * @param request {@link HttpServletRequest}
 * @return int
 */
public static int getEventId(final HttpServletRequest request) {
    Pair<String, Integer> webflowkey = getExecutionSessionKey(request.getParameter(PARAMETER_EXECUTION));
    Integer eventId = webflowkey.getRight();
    return eventId != null ? eventId.intValue() : 1;
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.student.ReadShiftsAndGroups.java

private static Object calculateVacancies(Integer groupMaximumNumber, int studentGroupsCount) {
    return (groupMaximumNumber != null) ? Integer.valueOf((groupMaximumNumber.intValue() - studentGroupsCount))
            : "Sem limite";
}

From source file:Main.java

public static String getIDName(View view, Class<?> clazz) {

    try {/*from  w  ww  . j a  va  2  s .com*/
        Integer id = view.getId();
        Field[] ids = clazz.getFields();
        for (int i = 0; i < ids.length; i++) {
            Object val = ids[i].get(null);
            if (val != null && val instanceof Integer && ((Integer) val).intValue() == id.intValue()) {
                return ids[i].getName();
            }
        }
    } catch (Exception e) {
    }
    return "";
}

From source file:pt.ist.expenditureTrackingSystem.presentationTier.actions.statistics.ChartGenerator.java

public static CategoryDataset simplifiedProcessStatisticsChart(
        final SimplifiedProcessStatistics simplifiedProcessStatistics) {
    final DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    final Map<AcquisitionProcessStateType, Integer> map = simplifiedProcessStatistics
            .getNumberOfProcessesByAcquisitionProcessStateType();
    char c = 'A';
    for (final Entry<AcquisitionProcessStateType, Integer> entry : map.entrySet()) {
        final AcquisitionProcessStateType acquisitionProcessStateType = entry.getKey();
        final Integer numberOfProcesses = entry.getValue();

        if (numberOfProcesses.intValue() > 0) {
            dataset.addValue(numberOfProcesses, "" + c + " - " + acquisitionProcessStateType.getLocalizedName(),
                    Character.valueOf(c++));
        }/*  w ww.  j av  a  2s. c  o m*/
    }

    return dataset;
}

From source file:pt.ist.expenditureTrackingSystem.presentationTier.actions.statistics.ChartGenerator.java

public static CategoryDataset refundProcessStatisticsChart(
        final RefundProcessStatistics refundProcessStatistics) {
    final DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    final Map<RefundProcessStateType, Integer> map = refundProcessStatistics
            .getNumberOfProcessesByRefundProcessStateType();
    char c = 'A';
    for (final Entry<RefundProcessStateType, Integer> entry : map.entrySet()) {
        final RefundProcessStateType refundProcessStateType = entry.getKey();
        final Integer numberOfProcesses = entry.getValue();

        if (numberOfProcesses.intValue() > 0) {
            dataset.addValue(numberOfProcesses, "" + c + " - " + refundProcessStateType.getLocalizedName(),
                    Character.valueOf(c++));
        }/*from  ww  w  .j  av  a2 s.  co m*/
    }

    return dataset;
}

From source file:Main.java

public static <K, V> List<Integer> getIndexListByValues(Map<K, V> map, Object[] values) {
    if ((values == null) || (values.length == 0)) {
        return null;
    }//from ww w.ja v  a2  s .c o  m
    List<Integer> indexList = new ArrayList<Integer>(map.size());
    Integer i = Integer.valueOf(0);
    for (V v : map.values()) {
        for (Object value : values) {
            if ((v == value) || (v.equals(value))) {
                indexList.add(i);
            }
        }
        i = Integer.valueOf(i.intValue() + 1);
    }
    return indexList;
}

From source file:com.projity.grouping.core.summaries.SummaryVisitorFactory.java

/**
 * Used when reading in config file to transform a summary name into an id
 * @param name/*  w  ww .  j  a va  2  s. c o  m*/
 * @return
 */
public static int getSummaryId(String name) {
    Integer id = (Integer) ALL_SUMMARY_MAP.get(name);
    if (id == null)
        return NONE;
    return id.intValue();
}

From source file:Main.java

/**
 * Returns a {@link Map} mapping each unique element in the given
 * {@link Collection} to an {@link Integer} representing the number of
 * occurances of that element in the {@link Collection}. An entry that maps
 * to <tt>null</tt> indicates that the element does not appear in the given
 * {@link Collection}./*w  w w  . j  a va 2s . c om*/
 */
public static Map getCardinalityMap(final Collection col) {
    HashMap count = new HashMap();
    Iterator it = col.iterator();
    while (it.hasNext()) {
        Object obj = it.next();
        Integer c = (Integer) (count.get(obj));
        if (null == c) {
            count.put(obj, new Integer(1));
        } else {
            count.put(obj, new Integer(c.intValue() + 1));
        }
    }
    return count;
}