Java ListResourceBundle .handleKeySet ()

Syntax

ListResourceBundle.handleKeySet() has the following syntax.

protected Set <String> handleKeySet()

Example

In the following code shows how to use ListResourceBundle.handleKeySet() method.


/*www .j a  v  a2s.  c  om*/

import java.util.*;


class MyResources extends ListResourceBundle {


   protected Object[][] getContents() {
      return new Object[][]{
                 {"hello", "from java2s.com"},
                 {"client", "HTML"},
                 {"server", "PHP"}
              };
   }
   
   protected Set<String>  handleKeySet() {
      return new HashSet<String> ();
      
   }
}

public class Main {
   public static void main(String[] args) {
      MyResources mr = new MyResources();

      // get the object for key hello
      System.out.println(mr.getString("hello"));
   }
}

The code above generates the following result.