Here you can find the source of pluralize(long val, String singular, String plural)
Parameter | Description |
---|---|
val | Number to be tested. |
singular | Singular form of the value description. |
plural | Plural form of the value description. |
public static String pluralize(long val, String singular, String plural)
//package com.java2s; //License from project: Open Source License public class Main { /**//from www . ja v a2 s. c o m * Determines whether the singular or plural version of a word should be used. * * @param val Number to be tested. * @param singular Singular form of the value description. * @param plural Plural form of the value description. * @return Singular form of the description if {@code val} is 1, the plural form otherwise. */ public static String pluralize(long val, String singular, String plural) { return (val == 1) ? singular : plural; } }