adjust
Adjust the element using the function.
R.adjust.run(R.inc, 1, R.with(1, 2, 3))
// (1, 3, 3)
Adjust the element using the function.
R.adjust.run(R.inc, 1, R.with(1, 2, 3))
// (1, 3, 3)
Check if all elements match the predicate.
R.all.run(R.isNotNull, R.with(1, 2, 3))
// true
Append an element to the elements.
R.append.run(1, R.with(1, 2, 3))
// (1, 2, 3, 1)
Set the key value.
R.assoc.run('name', 'test', new Map())
// {name=test}
Map over both the keys and values.
R.bimap.run(R.append.apply('_key'), R.append.apply('_value'), R.withObj('name', 'test'))
// {test_key=test_value}
Concatenate two objects.
R.concat.run(R.with(1, 2, 3), R.with(4, 5, 6))
// (4, 5, 6, 1, 2, 3)
Check if the element is contained.
R.contains.run(1, R.with(1, 2, 3))
// true
Check if the element is contained by the comparator returning boolean.
R.containsBy.run(R.equals, 1, R.with(1, 2, 3))
// true
Check if the key is contained.
R.containsKey.run('name', new Map{ 'name' => 'test' })
// true
Get counts by the key.
R.countBy.run(R.identity, R.with(1, 2, 2))
// {1=1, 2=2}
Make a difference of the two objects.
R.difference.run(R.with(1, 2, 3), R.with(2, 3, 4))
// (4)
Remove the key value.
R.dissoc.run('name', new Map{ 'name' => 'test' })
// {}
Insert element at the index.
R.doInsert.run(1, 'x', R.with(1, 2, 3))
// (1, x, 2, 3)
Insert elements at the index.
R.doInsertAll.run(1, R.with('x', 'y'), R.with(1, 2, 3))
// (1, x, y, 2, 3)
Join the elements by the separator.
R.doJoin.run('-', R.with(1, 2, 3))
// 1-2-3
Map over the elements.
R.doMap.run(R.inc, R.with(1, 2, 3))
// (2, 3, 4)
Update an element of the elements.
R.doUpdate.run(1, 3, R.with(1, 2, 3))
// (1, 3, 3)
Drop first N elements.
R.drop.run(1, 'abc')
// bc
Drop first N elements from right.
R.dropRight.run(1, 'abc')
// ab
Drop elements from right until not satisfied.
R.dropRightWhile.run(R.equals.apply('a'), 'abc')
// abc
Drop elements until not satisfied.
R.dropWhile.run(R.equals.apply('a'), 'abc')
// bc
Check ending with.
R.endsWith('a', 'abc')
// false
Same as all
.
Filter on the elements.
R.filter.run(R.isNotNull, R.with('a', null, 'b'))
// (a, b)
Find the first element that matches the predicate.
R.find.run(R.equals.apply('a'), R.with('a', 'b'))
// a
Find the index of the first element that matches the predicate.
R.findIndex.run(R.equals.apply('a'), R.with('a', 'b'))
// 0
Find the first element from last that matches the predicate.
R.findLast.run(R.equals.apply('a'), R.with('a', 'b'))
// a
Find the index of the first element from last that matches the predicate.
R.findLastIndex.run(R.equals.apply('a'), R.with('a', 'b'))
// 0
Get the first element.
R.first.run(R.with(1, 2, 3))
// 1
Flatten the elements recursively.
R.flatten.run(R.with(1, R.with(2, R.with(3))))
// (1, 2, 3)
Do for-each on the elements.
R.forEach.run(R.debug, R.with(1, 2, 3));
// 1
// 2
// 3
Convert a list of pairs to map.
R.fromPairs.run(R.with(new R.Pair('a', 1)))
// {a=1}
Get groups by the key.
R.groupBy.run(R.identity, R.with(1, 2, 2))
// {1=(1), 2=(2, 2)}
Same as first
.
Get indexes by the key.
R.indexBy.run(R.identity, R.with(1, 2, 2))
// {1=1, 2=2}
Get the index of the first element found.
R.indexOf.run(1, R.with(1, 2, 3))
// 0
Get the elements except the last.
R.init.run(R.with(1, 2, 3))
// (1, 2)
Make an intersection of the two objects.
R.intersection.run(R.with(1, 2, 3), R.with(2, 3, 4))
// (2, 3)
Check if it is empty.
R.isEmpty.run(R.with(1, 2, 3))
// false
Get the last element.
R.last.run(R.with(1, 2, 3))
// 3
Get the index of the first element found from the last.
R.lastIndexOf.run(1, R.with(1, 2, 3))
// 0
Get the length.
R.length.run(R.with(1, 2, 3))
// 3
Check if none of the elements match the predicate.
R.none.run(R.isNotNull, R.with(1, 2, 3))
// true
Get the nth element.
R.nth.run(1, R.with(1, 2, 3))
// 2
Create a pair.
R.pair.run(1, 2)
// Pair:[fst=1, snd=2]
Create a partitioned pair using the predicate.
R.partition.run(R.equals.apply('a'), R.with('a', 'b', 'c'))
// Pair:[fst=(a), snd=(b, c)]
Pluck the fields out of elements.
R.pluck.run('Description', R.with(new Account(Description='desc')))
// (desc)
Prepend an element to the elements.
R.prepend.run(1, R.with(1, 2, 3))
// (1, 1, 2, 3)
Project elements into other elements according to the fields.
R.project.run(R.with('Description'), R.with(new Account(Description='desc')))
// ({Description=desc})
Generate a range of decimals.
R.range.run(1, 3)
// (1, 2)
Reduce over the elements.
R.reduce.run(R.add, 0, R.with(1, 2, 3))
// 6
Reject on the elements.
R.reject.run(R.isNull, R.with('a', null, 'b'))
// (a, b)
Remove elements.
R.remove.run(1, 2, R.with(1, 2, 3))
// (1)
Repeat the target to generate elements.
R.repeat.run(5, 'a')
// (a, a, a, a, a)
Reverse the elements.
R.reverse.run('abc')
// cba
Get a random element.
R.sample.run('abcdef')
// e
Get a list of random elements.
R.sampleSize.run(2, 'abcdef')
// df
Create a shuffled collection.
R.shuffle.run('abcdef')
// fdeabc
Get the size. See length
.
Get a slice of the elements.
R.slice.run(0, 1, R.with(1, 2, 3))
// (1)
Check if some elements match the predicate.
R.some.run(R.isNotNull, R.with(1, 2, 3))
// false
Sort by the comparator.
R.sortBy.run(R.compare, R.with(3, 2, 1))
// (1, 2, 3)
Sort by default.
R.sortDefault.run(R.with(3, 2, 1))
// (1, 2, 3)
Check starting with.
R.startsWith('a', 'abc')
// true
Get the sum.
R.sum.run(R.with(1, 2, 3))
// 6
Get the elements except the first.
R.tail.run(R.with(1, 2, 3))
// (2, 3)
Take the first N elements.
R.take.run(1, 'abc')
// a
Take the first N elements from right.
R.takeRight.run(1, 'abc')
// c
Take elements from right until not satisfied.
R.takeRightWhile.run(R.equals.apply('a'), 'abc')
//
Take elements until not satisfied.
R.takeWhile.run(R.equals.apply('a'), 'abc')
// a
Invoke a function for N times.
R.times.run(3, R.identity)
// (0, 1, 2)
Convert a map to a list of pairs.
R.toPairs.run(new Map{ 'name' => 'test' })
// (Pair:[fst=name, snd=test])
Make a union of the two objects.
R.union.run(R.with(1, 2, 3), R.with(2, 3, 4))
// (2, 3, 4, 1)
Get a unique collection of the elements.
R.uniq.run(R.with(1, 2, 2))
// (1, 2)
Flatten the elements by one level.
R.unnest.run(R.with(1, R.with(2, 3)))
// (1, 2, 3)
Same with difference
.
Make an xor of the two objects.
R.xor.run(R.with(1, 2, 3), R.with(2, 3, 4))
// (4, 1)
Zip two collections to create a list of pairs.
R.zip.run(R.with('a', 'b'), R.with(1, 2))
// (Pair:[fst=a, snd=1], Pair:[fst=b, snd=2])
Zip two collections to create a map.
R.zipObj.run(R.with('a', 'b'), R.with(1, 2))
// {a=1, b=2}
Contribute on Github! Edit this section.