Package com.ibm.icu.util
Class LocalePriorityList.Builder
java.lang.Object
com.ibm.icu.util.LocalePriorityList.Builder
- Enclosing class:
LocalePriorityList
Class used for building LocalePriorityLists.
-
Method Summary
Modifier and TypeMethodDescriptionadd
(LocalePriorityList list) Adds locales with weights.Adds a locale with weight 1.0.Adds locales, each with weight 1.0.Adds a locale with a specified weight.Parses the RFC 2616 string, and adds locales with weights accordingly.build()
Creates a LocalePriorityList.build
(boolean preserveWeights) Creates a LocalePriorityList.
-
Method Details
-
build
Creates a LocalePriorityList. This is equivalent toBuilder.build(false)
.- Returns:
- A LocalePriorityList
-
build
Creates a LocalePriorityList.- Parameters:
preserveWeights
- when true, each locale's given weight is preserved.- Returns:
- A LocalePriorityList
-
add
Adds locales with weights.- Parameters:
list
- list of locales with weights- Returns:
- this, for chaining
-
add
Adds a locale with weight 1.0.- Parameters:
locale
- to add with weight 1.0- Returns:
- this, for chaining
-
add
Adds locales, each with weight 1.0.- Parameters:
locales
- locales/languages to be added- Returns:
- this, for chaining.
-
add
Adds a locale with a specified weight. Overrides any previous weight for the locale. A zero or negative weight leads to removing the locale. A weight greater than 1 is pinned to 1.- Parameters:
locale
- language/locale to addweight
- value between 0.0 and 1.1- Returns:
- this, for chaining.
-
add
Parses the RFC 2616 string, and adds locales with weights accordingly.- Parameters:
acceptLanguageList
- in RFC 2616 format (leniently parsed)- Returns:
- this, for chaining.
-