// OfferLast inserts the specified element at the end of this deque unless it would violate capacity restrictions.
// return if the element was added to this deque
432322
func (q *LinkedBlockingDeque) OfferLast(e interface{}) bool {
	if e == nil {
		return false
	}
	q.lock.Lock()
	result := q.linkLast(e)
	q.lock.Unlock()
	return result
}
87268
func (b *GCSBuilder) Preallocate(n uint32) *GCSBuilder {
	// Do nothing if the builder's already errored out.
	if b.err != nil {
		return b
	}

	if b.data == nil {
		b.data = make(map[string]struct{}, n)
	}

	return b
}
1168887
func (q *ListQueue) Dequeue() (interface{}, error) {
	if q.IsEmpty() {
		q.last = nil
		return nil, errors.New("unable to dequeue element, queue is empty")
	}

	item := q.first.item
	q.first = q.first.next
	q.size--
	return item, nil
}
1309737
func (bp *Pool) Put(obj interface{}) {
	finalize := true
	if bp.CanReturn == nil || bp.CanReturn(obj) {
		finalize = !bp.pool.Offer(obj)
	}

	if finalize && bp.Finalize != nil {
		bp.Finalize(obj)
	}
}
371426
func (l *waiterList) InsertAfter(b, e *Entry) {
	a := waiterElementMapper{}.linkerFor(b).Next()
	waiterElementMapper{}.linkerFor(e).SetNext(a)
	waiterElementMapper{}.linkerFor(e).SetPrev(b)
	waiterElementMapper{}.linkerFor(b).SetNext(e)

	if a != nil {
		waiterElementMapper{}.linkerFor(a).SetPrev(e)
	} else {
		l.tail = e
	}
}
549608
func CopyPrepend(slice []interface{}, elements ...interface{}) []interface{} {
	elementsLength := len(elements)
	newSlice := make([]interface{}, len(slice)+elementsLength)
	for i, e := range elements {
		newSlice[i] = e
	}
	for i, e := range slice {
		newSlice[elementsLength+i] = e
	}
	return newSlice
}
560953
func (s *RedisDownlinkQueue) PushLast(msg *types.DownlinkMessage) error {
	qd, err := json.Marshal(msg)
	if err != nil {
		return err
	}
	return s.queues.AddEnd(s.key(), string(qd))
}
925719
func (s *QueryOutput) SetLastEvaluatedKey(v map[string]*AttributeValue) *QueryOutput {
	s.LastEvaluatedKey = v
	return s
}
1026484
func (e *endpointImpl) allocate(devs []string) (*pluginapi.AllocateResponse, error) {
	if e.isStopped() {
		return nil, fmt.Errorf(errEndpointStopped, e)
	}
	return e.client.Allocate(context.Background(), &pluginapi.AllocateRequest{
		ContainerRequests: []*pluginapi.ContainerAllocateRequest{
			{DevicesIDs: devs},
		},
	})
}
400730
func (q *LinkedBlockingDeque) AddFirst(e interface{}) error {
	if e == nil {
		return errors.New("e is nil")
	}
	if !q.OfferFirst(e) {
		return errors.New("Deque full")
	}
	return nil
}
293050
func (c *offerCommand) Init(args []string) error {
	if len(args) < 1 {
		return errors.New("an offer must at least specify application endpoint")
	}
	c.endpointsSpec = args[0]
	argCount := 1
	if len(args) > 1 {
		argCount = 2
		c.OfferName = args[1]
	}
	return cmd.CheckEmpty(args[argCount:])
}
264331
func (cache *schedCache) containsOffer(offerId *mesos.OfferID) bool {
	cache.lock.RLock()
	defer cache.lock.RUnlock()
	_, ok := cache.savedOffers[offerId.GetValue()]
	return ok
}
1116506
func (sb *sandbox) joinLeaveEnd() {
	sb.Lock()
	defer sb.Unlock()

	if sb.joinLeaveDone != nil {
		close(sb.joinLeaveDone)
		sb.joinLeaveDone = nil
	}
}
711969
func (t *SecondaryTree) SeekLast() (e *SecondaryEnumerator, err error) {
	q := t.last
	if q == nil {
		return nil, io.EOF
	}

	return btEPool2.get(nil, true, q.c-1, q.d[q.c-1].k, q, t, atomic.LoadUint64(&t.ver)), nil
}
957684
func (q *ListQueue) Enqueue(item interface{}) {
	last := new(node)
	last.item = item

	if q.IsEmpty() {
		q.first = last
	} else {
		oldLast := q.last
		oldLast.next = last
	}
	q.last = last
	q.size++
}
1324141
func (d *BillDetail) IsContractEnded(t time.Time) bool {
	return d.ContractEndAt != nil && d.ContractEndAt.Before(t)
}
337150
func (d *defrag) setLast(lastOrdinal int64) {
	select {
	case d.lastOrdinalNotify <- lastOrdinal:
	case <-d.done:
	}
}