simple_bloom_filter 0.1.3 copy "simple_bloom_filter: ^0.1.3" to clipboard
simple_bloom_filter: ^0.1.3 copied to clipboard

outdated

A simple bloom filter implementation in Dart. Bloom filters are a space-efficient probabilistic data structure that is used to test whether an element is a member of a set.

example/simple_bloom_filter_example.dart

import 'package:simple_bloom_filter/simple_bloom_filter.dart';

void main() {
  var bloom = simple_bloom_filter(10000, 3);

  bloom.add('hello world');
  bloom.add(1234567890.toString());
  bloom.add('{"first-name": "Dart", "last-name": "lang"}');

  if (bloom.check('hello world') == true) {
    print('"hello world" PROBABLY exists...');
  }
  else {
    print('"hello world" DEFINITELY does not exist...');
  }
  if (bloom.check(1234567890.toString()) == true) {
    print('"1234567890" PROBABLY exists...');
  }
  else {
    print('"1234567890" DEFINITELY does not exist...');
  }
  if (bloom.check('{"first-name": "Dart", "last-name": "lang"}') == true) {
    print('"{"first-name": "Dart", "last-name": "lang"}" PROBABLY exists...');
  }
  else {
    print('"{"first-name": "Dart", "last-name": "lang"}" DEFINITELY does not exist...');
  }
  if (bloom.check('{"first-name": "Go", "last-name": "lang"}') == true) {
    print('"{"first-name": "Go", "last-name": "lang"}" PROBABLY exists...');
  }
  else {
    print('"{"first-name": "Go", "last-name": "lang"}" DEFINITELY does not exist...');
  }
}
4
likes
40
points
34
downloads

Publisher

unverified uploader

Weekly Downloads

A simple bloom filter implementation in Dart. Bloom filters are a space-efficient probabilistic data structure that is used to test whether an element is a member of a set.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

More

Packages that depend on simple_bloom_filter