[Java] Powerset solution
\nclass CombinationIterator {\n    private Queue<String> queue;\n    \n    public CombinationIterator(String characters, int combinationLength) {\n        queue
```\nclass CombinationIterator {\n    private Queue<String> queue;\n    \n    public CombinationIterator(String characters, int combinationLength) {\n        queue = new PriorityQueue<>();\n        \n        for (int i = 0; i < (1 << characters.length()); i++) {\n            if (Integer.bitCount(i) != combinationLength) {\n                continue;\n            }\n            \n            char[] comb = new char[combinationLength];\n            int index = 0;\n            \n            for (int j = 0; j < characters.length(); j++) {\n                int bit = 1 << j;\n                if ((bit & i) == bit) {\n                    comb[index++] = characters.charAt(j);\n                }\n            }\n            \n            queue.add(new String(comb));\n        }\n    }\n    \n    public String next() {\n        return queue.poll();\n    }\n    \n    public boolean hasNext() {\n        return queue.isEmpty() == false;\n    }\n}\n```
[]