Java examples for java.nio:CharBuffer
Is the character at index 'pos' of CharBuffer one of the characters in the 'candidate Characters' array?
//package com.java2s; import java.nio.CharBuffer; public class Main { /**//from w ww . j ava 2 s. c om * Is the character at index 'pos' of 'buf' one of the characters in the * 'candidateCharacters' array? */ public static boolean isOneOf(int pos, CharBuffer buf, char[] candidateCharacters) { char c = buf.get(pos); for (int i = 0; i < candidateCharacters.length; i++) { if (candidateCharacters[i] == c) { return true; } } return false; } }