Help us shape the future of Go! Take the 2026 Go Developer Survey

collections

package module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2018 License: MIT Imports: 0 Imported by: 4

README

collections

GoDoc

Set of functions that help us work with slices and maps.

Install
go get github.com/altipla-consulting/collections

This library has no external dependencies outside the Go standard library.

Usage
package main

import (
  "fmt"
  "github.com/altipla-consulting/collections"
)

  func main() {
    goFounders := []string{"Robert Griesemer", "Rob Pike", "Ken Thompson"}
    fmt.Println("Fracis McCabe:", collections.HasString(goFounders, "Francis McCabe"))
    fmt.Println("RobertGriesemer:", collections.HasString(goFounders, "RobertGriesemer"))
    fmt.Println("Robert Griesemer:", collections.HasString(goFounders, "Robert Griesemer"))
  }
)

Result:

Fracis McCabe: false 
RobertGriesemer: false 
Robert Griesemer: true 
Contributing

You can make pull requests or create issues in GitHub. Any code you send should be formatted using gofmt.

License

MIT License

Documentation

Overview

Package collections is a set of functions that help us work with slices and maps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareInts32

func CompareInts32(lhs, rhs []int32) bool

CompareInts32 returns true if the values of both lhs & rhs are the same.

func CompareInts64

func CompareInts64(lhs, rhs []int64) bool

CompareInts64 returns true if the values of both lhs & rhs are the same.

func CompareStrings

func CompareStrings(lhs, rhs []string) bool

CompareStrings returns true if the values of both lhs & rhs are the same.

func DifferenceStrings

func DifferenceStrings(a, b []string) []string

DifferenceStrings returns the items present in a and not in b.

func HasInt32

func HasInt32(list []int32, search int32) bool

HasInt32 returns true if list contains search

func HasInt64

func HasInt64(list []int64, search int64) bool

HasInt64 returns true if list contains search.

func HasString

func HasString(list []string, search string) bool

HasString returns true if list contains search.

func RemoveInt32 added in v0.3.0

func RemoveInt32(list []int32, remove int32) []int32

RemoveInt32 return list without remove.

func RemoveInt64 added in v0.3.0

func RemoveInt64(list []int64, remove int64) []int64

RemoveInt64 return list without remove.

func RemoveString

func RemoveString(list []string, remove string) []string

RemoveString return list without remove.

func ReverseInt32 added in v0.2.0

func ReverseInt32(list []int32) []int32

ReverseInt32 returns a reversed list

func ReverseInt64

func ReverseInt64(list []int64) []int64

ReverseInt64 returns a reversed list

func ReverseString

func ReverseString(list []string) []string

ReverseInt64 returns a reversed list

func UniqueIntegers32

func UniqueIntegers32(list []int32) []int32

UniqueIntegers32 returns list without any duplicates in it.

func UniqueIntegers64

func UniqueIntegers64(list []int64) []int64

UniqueIntegers64 returns list without any duplicates in it.

func UniqueStrings

func UniqueStrings(list []string) []string

UniqueStrings returns list without any duplicates in it.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL