Code Monkey home page Code Monkey logo

gocollections's Introduction

gocollections

Basic Generic Collections Library for Golang with interfaces to provide implementation-agnostic abstractions over various collections

Installation

go get github.com/golanglibs/gocollections@latest

List of Implemented Data Structures

Provided Collection Interfaces and their implementations

  • Collectioner[T any]

  • Lister[T any]

    • Provides operations for list-like collections
    • Provides the following operations:
      • SetEqualityComparer(equals func(*T, *T) bool):
      • At(index int) *T
      • Set(index int, value T)
      • Size() int
      • Empty() bool
      • Front() *T
      • Back() *T
      • Add(element T) bool
      • RemoveBack()
      • Insert(index int, value T) bool
      • AddToFront(element T)
      • RemoveFront()
      • Remove(element T) bool
      • RemoveAt(index int)
      • IndexOf(element T) int
      • Contains(element T) bool
      • SubList(start int, end int) Lister[T]
      • Clear()
      • ForEach(do func(*T))
    • Implemented by:
  • Seter[K comparable]

    • Provides operations for set-like collections
    • Provides the following operations:
      • Size() int
      • Empty() bool
      • Add(element K) bool
      • Remove(element K) bool
      • Contains(element K) bool
      • Equals(set Seter[K]) bool
      • Intersects(set Seter[K]) bool
      • GetIntersection(set Seter[K]) Seter[K]
      • GetUnion(set Seter[K]) Seter[K]
      • IsSupersetOf(set Seter[K]) bool
      • IsSubsetOf(set Seter[K]) bool
      • Clear()
      • ForEach(do func(*K))
    • Implemented By:
  • Queuer[T any]

    • Provides operations for queue-like collections
    • Provides the following operations
      • SetEqualityComparer(equals func(*T, *T) bool)
      • Size() int
      • Empty() bool
      • Enqueue(element T)
      • Dequeue()
      • Peek() *T
      • Contains(element T) bool
      • Clear()
      • ForEach(do func(*T))
    • Implemented By:
  • Stacker[T any]

    • Provides operations for stack-like collections
    • Provides the following operations:
      • SetEqualityComparer(equals func(*T, *T) bool)
      • Size() int
      • Empty() bool
      • Push(T)
      • Pop()
      • Peek() *T
      • Contains(element T) bool
      • Clear()
      • ForEach(do func(*T))
    • Implemented By:

Possible Improvements

  • Add SortedMap (TreeMap) and SortedSet (TreeSet)
  • Add Stream APIs using Collectioner
  • Add more collection methods such as Map and Filter

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.