gfc-collection


License

License

GroupId

GroupId

org.gfccollective
ArtifactId

ArtifactId

gfc-collection_2.13
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

gfc-collection
gfc-collection
Project URL

Project URL

https://github.com/gfc-collective/gfc-collection
Project Organization

Project Organization

org.gfccollective
Source Code Management

Source Code Management

https://github.com/gfc-collective/gfc-collection.git

Download gfc-collection_2.13

How to add to project

<!-- https://jarcasting.com/artifacts/org.gfccollective/gfc-collection_2.13/ -->
<dependency>
    <groupId>org.gfccollective</groupId>
    <artifactId>gfc-collection_2.13</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.gfccollective/gfc-collection_2.13/
implementation 'org.gfccollective:gfc-collection_2.13:1.0.0'
// https://jarcasting.com/artifacts/org.gfccollective/gfc-collection_2.13/
implementation ("org.gfccollective:gfc-collection_2.13:1.0.0")
'org.gfccollective:gfc-collection_2.13:jar:1.0.0'
<dependency org="org.gfccollective" name="gfc-collection_2.13" rev="1.0.0">
  <artifact name="gfc-collection_2.13" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.gfccollective', module='gfc-collection_2.13', version='1.0.0')
)
libraryDependencies += "org.gfccollective" % "gfc-collection_2.13" % "1.0.0"
[org.gfccollective/gfc-collection_2.13 "1.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.13.1

test (3)

Group / Artifact Type Version
org.scalatest : scalatest_2.13 jar 3.1.0
org.scalatestplus : scalacheck-1-14_2.13 jar 3.1.0.1
org.scalacheck : scalacheck_2.13 jar 1.14.3

Project Modules

There are no modules declared in this project.

gfc-collection Maven Central Build Status Coverage Status

A library that contains scala collection utility classes. A fork and new home of the now unmaintained Gilt Foundation Classes (com.gilt.gfc), now called the GFC Collective, maintained by some of the original authors.

Getting gfc-collection

The latest version is 1.0.0, released on 21/Jan/2020 and cross-built against Scala 2.12.x and 2.13.x.

If you're using SBT, add the following line to your build file:

libraryDependencies += "org.gfccollective" %% "gfc-collection" % "1.0.0"

For Maven and other build tools, you can visit search.maven.org. (This search will also list other available libraries from the GFC Collective.)

Contents and Example Usage

org.gfccollective.collection.CircularBuffer

Simple non-thread-safe circular buffer implementation that supports adding a new item, finding the oldest item, the newest item, or iterating from oldest to newest.

val buffer = new CircularBuffer[Int](5)

buffer.add(0)
assert(buffer.oldest == 0)
assert(buffer.newest == 0)
assert(buffer.size == 1)

(1 to 4).foreach(buffer.add(_))
assert(buffer.oldest == 0)
assert(buffer.newest == 4)
assert(buffer.size == 5)

buffer.add(5)
assert(buffer.oldest == 1)
assert(buffer.newest == 5)
assert(buffer.size == 5)

org.gfccollective.collection.TopN

Utility to select top N items from a collection.

val numbers = scala.util.Random.shuffle(0 to 1000)
assert(TopN(5, numbers) == Seq(0, 1, 2, 3, 4))
assert(TopN(5, numbers)(scala.math.Ordering.Int.reverse) == Seq(1000, 999, 998, 997, 996))

License

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

org.gfccollective

The GFC Collective

The new home of the (former) Gilt Foundation Classes

Versions

Version
1.0.0