Replace the 2 with searchKey
On Fri, Jan 25, 2019, 12:12 PM Karun Chand <[email protected] wrote:
> Hey Andrew,
>
> I think this is what you are looking for -
>
> class Foo {
> int id;
> }
>
> class CustomIgniteBiPredicate implements IgniteBiPredicate<Integer,
> List<Foo>> {
> int searchKey;
>
> public CustomIgniteBiPredicate(int searchKey) {
> this.searchKey = searchKey;
> }
>
> public boolean apply(Integer key, List<Foo> list) {
> for (Foo item: list) {
> if (item.id == 2)
> return true;
> }
> return false;
> }
> }
>
> ScanQuery<Integer, List<Foo>> filter = new ScanQuery<Integer, List<Foo>>(new
> CustomIgniteBiPredicate(9999));
>
>
> ScanQuery is final in its declaration. So we can use a custom
> IgniteBiPredicate
>
> public final class ScanQuery<K, V> extends Query<Cache.Entry<K, V>> {
>
>
> Regards,
> RH
> https://www.apacheignitetutorial.com
>
> On Fri, Jan 25, 2019 at 8:36 AM AndrewV <[email protected]> wrote:
>
>> Hello.
>>
>> Is it possible to create a filter to find data inside typed List?
>>
>> *Example: *
>>
>> class Foo {
>> Integer id;
>> }
>>
>> *Query: *
>> ScanQuery<Integer, List<Foo>> filter = new ScanQuery<>(
>> (IgniteBiPredicate<Integer, List<Foo>>) (key, list) -> ...
>> );
>>
>> So, is it possible to find inside List<Foo> just records where
>> foo.getId().equals(some id)?
>>
>> Thanks.
>>
>>
>>
>>
>>
>> --
>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>
>