//go:build !no_gotd_slices
// +build !no_gotd_slices

// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// WallPaperClassArray is adapter for slice of WallPaperClass.
type WallPaperClassArray []WallPaperClass

// Sort sorts slice of WallPaperClass.
func ( WallPaperClassArray) ( func(,  WallPaperClass) bool) WallPaperClassArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of WallPaperClass.
func ( WallPaperClassArray) ( func(,  WallPaperClass) bool) WallPaperClassArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of WallPaperClass.
func ( WallPaperClassArray) ( func( WallPaperClass) bool) WallPaperClassArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( WallPaperClassArray) () ( WallPaperClass,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( WallPaperClassArray) () ( WallPaperClass,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *WallPaperClassArray) () ( WallPaperClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  WallPaperClass
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *WallPaperClassArray) () ( WallPaperClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// SortByID sorts slice of WallPaperClass by ID.
func ( WallPaperClassArray) () WallPaperClassArray {
	return .Sort(func(,  WallPaperClass) bool {
		return .GetID() < .GetID()
	})
}

// SortStableByID sorts slice of WallPaperClass by ID.
func ( WallPaperClassArray) () WallPaperClassArray {
	return .SortStable(func(,  WallPaperClass) bool {
		return .GetID() < .GetID()
	})
}

// FillWallPaperMap fills only WallPaper constructors to given map.
func ( WallPaperClassArray) ( map[int64]*WallPaper) {
	for ,  := range  {
		,  := .(*WallPaper)
		if ! {
			continue
		}
		[.GetID()] = 
	}
}

// WallPaperToMap collects only WallPaper constructors to map.
func ( WallPaperClassArray) () map[int64]*WallPaper {
	 := make(map[int64]*WallPaper, len())
	.FillWallPaperMap()
	return 
}

// AsWallPaper returns copy with only WallPaper constructors.
func ( WallPaperClassArray) () ( WallPaperArray) {
	for ,  := range  {
		,  := .(*WallPaper)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// FillWallPaperNoFileMap fills only WallPaperNoFile constructors to given map.
func ( WallPaperClassArray) ( map[int64]*WallPaperNoFile) {
	for ,  := range  {
		,  := .(*WallPaperNoFile)
		if ! {
			continue
		}
		[.GetID()] = 
	}
}

// WallPaperNoFileToMap collects only WallPaperNoFile constructors to map.
func ( WallPaperClassArray) () map[int64]*WallPaperNoFile {
	 := make(map[int64]*WallPaperNoFile, len())
	.FillWallPaperNoFileMap()
	return 
}

// AsWallPaperNoFile returns copy with only WallPaperNoFile constructors.
func ( WallPaperClassArray) () ( WallPaperNoFileArray) {
	for ,  := range  {
		,  := .(*WallPaperNoFile)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// WallPaperArray is adapter for slice of WallPaper.
type WallPaperArray []WallPaper

// Sort sorts slice of WallPaper.
func ( WallPaperArray) ( func(,  WallPaper) bool) WallPaperArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of WallPaper.
func ( WallPaperArray) ( func(,  WallPaper) bool) WallPaperArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of WallPaper.
func ( WallPaperArray) ( func( WallPaper) bool) WallPaperArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( WallPaperArray) () ( WallPaper,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( WallPaperArray) () ( WallPaper,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *WallPaperArray) () ( WallPaper,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  WallPaper
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *WallPaperArray) () ( WallPaper,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// SortByID sorts slice of WallPaper by ID.
func ( WallPaperArray) () WallPaperArray {
	return .Sort(func(,  WallPaper) bool {
		return .GetID() < .GetID()
	})
}

// SortStableByID sorts slice of WallPaper by ID.
func ( WallPaperArray) () WallPaperArray {
	return .SortStable(func(,  WallPaper) bool {
		return .GetID() < .GetID()
	})
}

// FillMap fills constructors to given map.
func ( WallPaperArray) ( map[int64]WallPaper) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( WallPaperArray) () map[int64]WallPaper {
	 := make(map[int64]WallPaper, len())
	.FillMap()
	return 
}

// WallPaperNoFileArray is adapter for slice of WallPaperNoFile.
type WallPaperNoFileArray []WallPaperNoFile

// Sort sorts slice of WallPaperNoFile.
func ( WallPaperNoFileArray) ( func(,  WallPaperNoFile) bool) WallPaperNoFileArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of WallPaperNoFile.
func ( WallPaperNoFileArray) ( func(,  WallPaperNoFile) bool) WallPaperNoFileArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of WallPaperNoFile.
func ( WallPaperNoFileArray) ( func( WallPaperNoFile) bool) WallPaperNoFileArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( WallPaperNoFileArray) () ( WallPaperNoFile,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( WallPaperNoFileArray) () ( WallPaperNoFile,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *WallPaperNoFileArray) () ( WallPaperNoFile,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  WallPaperNoFile
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *WallPaperNoFileArray) () ( WallPaperNoFile,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// SortByID sorts slice of WallPaperNoFile by ID.
func ( WallPaperNoFileArray) () WallPaperNoFileArray {
	return .Sort(func(,  WallPaperNoFile) bool {
		return .GetID() < .GetID()
	})
}

// SortStableByID sorts slice of WallPaperNoFile by ID.
func ( WallPaperNoFileArray) () WallPaperNoFileArray {
	return .SortStable(func(,  WallPaperNoFile) bool {
		return .GetID() < .GetID()
	})
}

// FillMap fills constructors to given map.
func ( WallPaperNoFileArray) ( map[int64]WallPaperNoFile) {
	for ,  := range  {
		[.GetID()] = 
	}
}

// ToMap collects constructors to map.
func ( WallPaperNoFileArray) () map[int64]WallPaperNoFile {
	 := make(map[int64]WallPaperNoFile, len())
	.FillMap()
	return 
}