@Universal public static char[] add( char[] array, StringBuilder stringBuilder ) { return add( array, getCharsFromStringBuilder( stringBuilder ) ); }
public UniversalComparator(String sortBy, Map<String, FieldAccess> fields, SortType sortType, List<Comparator> comparators ) { this.sortBy = sortBy; this.fields = fields; this.sortType = sortType; this.comparators = comparators; this.byPath = Str.in(Chr.array('.', '[', ']', '/'), sortBy); }
@Universal public static void idx( final char[] array, int index, char[] input ) { final int i = calculateIndex( array, index ); _idx( array, i, input ); }
@Test public void outOfBounds() { char[] fruit = array( 'a', 'b', 'c', 'd', 'e' ); slcEnd( fruit, 100 ); slcEnd( fruit, -100 ); slc( fruit, 100 ); slc( fruit, -100 ); idx( fruit, 100 ); idx( fruit, -100 ); idx( fruit, 100, 'x' ); idx( fruit, -100, 'z' ); assertEquals( 'x', idx( fruit, -1 ) ); assertEquals( 'z', idx( fruit, 0 ) ); }
@Test public void addInsertArray() { assertArrayEquals( array( 'a', 'b', 'c', 'd', 'e', 'f', 'g' ), insert( array( 'a', 'b', 'e', 'f', 'g' ), 2, array( 'c', 'd' ) ) ); assertArrayEquals( array( 'a', 'b', 'c', 'd', 'e', 'f', 'g' ), insert( array( 'c', 'd', 'e', 'f', 'g' ), 0, array( 'a', 'b' ) ) ); }
@Universal public static void atIndex( final char[] array, int index, char[] input ) { idx(array, index, input); }
if ( c == split ) { results[ resultIndex ] = Chr.copy( inputArray, startCurrentLineIndex, currentLineLength - 1 ); startCurrentLineIndex = index + 1; //skip the char if ( !Chr.in( c, delims ) ) { results[ resultIndex ] = Chr.copy( inputArray, startCurrentLineIndex, currentLineLength - 1 ); resultIndex++;
fruitList = Lists.list( "apple", "oranges", "pineapple" ); fruitArray = array( "apple", "oranges", "pineapple" ); letters = Chr.array( 'a', 'b', 'c' ); bytes = array( new byte[]{ 0x1, 0x2, 0x3, 0x4 } ); assert Lists.len( fruitList ) == 3; assert len( fruitArray ) == 3; assert len( letters ) == 3; assert len( bytes ) == 4; assert Maps.len( favoritesMap ) == 3; assert idx( letters, 1 ) == 'b'; assert idx( letters, -2 ) == 'b';
/** * See if a char is in a string but in a certain bounds of string * @param c char * @param offset offset * @param end end of span to search * @param str string * @return true or false */ @Universal public static boolean in( char c, int offset, int end, String str ) { return Chr.in ( c, offset, end, FastStringUtils.toCharArray(str) ); }
@Universal public static char[] add( char[] array, String str ) { return add( array, str.toCharArray() ); }
@Universal public static char[] insert( final char[] array, final int fromIndex, StringBuilder values ) { return insert( array, fromIndex, getCharsFromStringBuilder( values ) ); }