Here you can find the source of pluralize(int count, String singular, String plural)
Parameter | Description |
---|---|
count | The number of items. |
singular | The output string iif count==1 . |
plural | The output string iif count!=1 . |
public static String pluralize(int count, String singular, String plural)
//package com.java2s; /* Please see the license information at the end of this file. */ public class Main { /**/*from w w w .j a v a 2 s . co m*/ * Select singular or plural string based upon count. * * @param count * The number of items. * @param singular * The output string iif count==1 . * @param plural * The output string iif count!=1 . * * @return Either singular or plural, based upon value of count. * */ public static String pluralize(int count, String singular, String plural) { return (count == 1) ? singular : plural; } /** * Select singular or plural string based upon count. * * @param count * The number of items. * @param singular * The output string iif count==1 . * @param plural * The output string iif count!=1 . * * @return Either singular or plural, based upon value of count. * */ public static String pluralize(long count, String singular, String plural) { return (count == 1) ? singular : plural; } }