GithubHelp home page GithubHelp logo

grnt426 / lazylist Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 108 KB

A lazy list evaluator. Operations can be applied to the entire list in O(1) time, but with reads requiring O(n), where n is the number of operations applied to the list.

Java 100.00%

lazylist's Introduction

LazyList

A specialized list for performing operations on a very large set of elements. This list guarantees O(1) for all operations applied to the list. Reads and updates to the list are guaranteed to be O(n), where n is the number of operations that have been applied to the list. Deletes are O(1).

The primary advantage of the LazyList is to support quickly applying a small number of operations that need to be performed on very large lists. Iterators are provided that allow for easy iteration across the list, including an iterator that updates each value and clears the list of operations for faster reads.

Note, that this class does NOT update the value of each element as it reads it. The only way to do this is to use a LazyUpdaterIterator to update each element and then flush the operations list.

Example Usage

LazyList list = new LazyList();
list.add(1);
list.add(2);
list.add(4);
list.add(7);
list.add(12);
list.multiply(3);

Result: [3, 6, 12, 21, 36]

Usage Dependencies

  • Java 1.6

Project Information

Authors

Grant Kurtz

Repository

https://github.com/grnt426/LazyList

Project Dependencies

  • Java: 1.6
  • Maven Library: apache-maven-3.0.4

Testing

mvn test

lazylist's People

Contributors

grnt426 avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.