| 831 | */ |
| 832 | // This is visible for testing. |
| 833 | List<int[]> findAllIndex(String s, int n) { |
| 834 | final List<int[]> result = new ArrayList<int[]>(); |
| 835 | allMatches( |
| 836 | MachineInput.fromUTF16(s), |
| 837 | n, |
| 838 | new DeliverFunc() { |
| 839 | @Override |
| 840 | public void deliver(int[] match) { |
| 841 | result.add(Utils.subarray(match, 0, 2)); |
| 842 | } |
| 843 | }); |
| 844 | if (result.isEmpty()) { |
| 845 | return null; |
| 846 | } |
| 847 | return result; |
| 848 | } |
| 849 | |
| 850 | /** |
| 851 | * {@code findAllUTF8Submatch} is the <a href='#all'>All</a> version of {@link #findUTF8Submatch}; |