collections

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2019 License: MIT Imports: 0 Imported by: 0

README


GoDoc

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

Basic usage

package main

import (
  "fmt"
  
  "libs.altipla.consulting/collections"
)

  func main() {
    goFounders := []string{"Robert Griesemer", "Rob Pike", "Ken Thompson"}
    fmt.Println("Francis 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 

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

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

RemoveInt32 return list without remove.

func RemoveInt64

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

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