Returns a list of compactable segments.

@return A list of compactable segments.
348680
private Iterable<Segment> getCompactableSegments(Storage storage, SegmentManager manager) {
    List<Segment> segments = new ArrayList<>(manager.segments().size());
    Iterator<Segment> iterator = manager.segments().iterator();
    Segment segment = iterator.next();
    while (iterator.hasNext()) {
      Segment nextSegment = iterator.next();

      // Segments that have already been compacted are eligible for compaction. For uncompacted segments, the segment must be full, consist
      // of entries less than the minorIndex, and a later segment with at least one committed entry must exist in the log. This ensures that
      // a non-empty entry always remains at the end of the log.
      if (segment.isCompacted() || (segment.isFull() && segment.lastIndex() < compactor.minorIndex() && nextSegment.firstIndex() <= manager.commitIndex() && !nextSegment.isEmpty())) {
        // Calculate the percentage of entries that have been released in the segment.
        double compactablePercentage = segment.releaseCount() / (double) segment.count();

        // If the percentage of entries released times the segment version meets the compaction threshold,
        // add the segment to the segments list for compaction.
        if (compactablePercentage * segment.descriptor().version() >= storage.compactionThreshold()) {
          segments.add(segment);
        }
      }

      segment = nextSegment;
    }
    return segments;
  }
1016184
public List<T> getAll() {
		List<T> result = new ArrayList<T>();
		if (nodes != null)
			for(Node element : nodes) 
				result.add(getCachedOrNewRepresentation(element));
		return result;
	}
	
	public int size() {
		return nodes.size();
	}
	
	public T get(int index) {
		return getCachedOrNewRepresentation(nodes.get(index));
	}
		
	public Iterator<T> iterator() {
		return getAll().iterator();
	}
}
683103
public List<ElementSubSet<E>> getPartitions() {
        final List<ElementSubSet<E>> partitions = new ArrayList<>();
        forEachPartition((idx, key, from, to) -> {
            partitions.add(new ElementSubSet<>(SplittableElementSet.this, key, from, to));
            return true;
        });
        return partitions;
    }
207677
public static List<TrackSegment> nonEmptySegments(
		final List<TrackSegment> segments
	) {
		return segments.stream()
			.filter(TrackSegment::nonEmpty)
			.collect(toList());
	}
925953
public static String getAllButLastSegment(final List<PathSegment> segments) {
        if (segments.isEmpty()) {
            return "";
        }
        return segments.subList(0, segments.size() - 1).stream().map(PathSegment::getPath)
                    .collect(joining("/"));
    }
1028800
def segments(self):
        '''
        

        '''
        return [Segment(self.AB),
                Segment(self.BC),
                Segment(self.AC)]
1357429
public static ArrayList<SegmentString> getSegments(Geometry inputLines, Geometry clipper) {
        ArrayList<SegmentString> segments = new ArrayList<SegmentString>();        
        addGeometryToSegments(inputLines, 0, segments);        
        addGeometryToSegments(clipper, 1, segments);
        return segments;
    }
175089
protected Collection<Segment> loadSegments() {
    // Ensure log directories are created.
    storage.directory().mkdirs();

    TreeMap<Long, Segment> segments = new TreeMap<>();

    // Iterate through all files in the log directory.
    for (File file : storage.directory().listFiles(File::isFile)) {

      // If the file looks like a segment file, attempt to load the segment.
      if (SegmentFile.isSegmentFile(name, file)) {
        SegmentFile segmentFile = new SegmentFile(file);
        SegmentDescriptor descriptor = new SegmentDescriptor(FileBuffer.allocate(file, SegmentDescriptor.BYTES));

        // Valid segments will have been locked. Segments that resulting from failures during log cleaning will be
        // unlocked and should ultimately be deleted from disk.
        if (descriptor.locked()) {

          // Load the segment.
          Segment segment = loadSegment(descriptor.id(), descriptor.version());

          // If a segment with an equal or lower index has already been loaded, ensure this segment is not superseded
          // by the earlier segment. This can occur due to segments being combined during log compaction.
          Map.Entry<Long, Segment> previousEntry = segments.floorEntry(segment.index());
          if (previousEntry != null) {

            // If an existing descriptor exists with a lower index than this segment's first index, check to determine
            // whether this segment's first index is contained in that existing index. If it is, determine which segment
            // should take precedence based on segment versions.
            Segment previousSegment = previousEntry.getValue();

            // If the two segments start at the same index, the segment with the higher version number is used.
            if (previousSegment.index() == segment.index()) {
              if (segment.descriptor().version() > previousSegment.descriptor().version()) {
                LOGGER.debug("Replaced segment {} with newer version: {} ({})", previousSegment.descriptor().id(), segment.descriptor().version(), segmentFile.file().getName());
                segments.remove(previousEntry.getKey());
                previousSegment.close();
                previousSegment.delete();
              } else {
                segment.close();
                segment.delete();
                continue;
              }
            }
            // If the existing segment's entries overlap with the loaded segment's entries, the existing segment always
            // supersedes the loaded segment. Log compaction processes ensure this is always the case.
            else if (previousSegment.index() + previousSegment.length() > segment.index()) {
              segment.close();
              segment.delete();
              continue;
            }
          }

          // Add the segment to the segments list.
          LOGGER.debug("Found segment: {} ({})", segment.descriptor().id(), segmentFile.file().getName());
          segments.put(segment.index(), segment);

          // Ensure any segments later in the log with which this segment overlaps are removed.
          Map.Entry<Long, Segment> nextEntry = segments.higherEntry(segment.index());
          while (nextEntry != null) {
            if (nextEntry.getValue().index() < segment.index() + segment.length()) {
              segments.remove(nextEntry.getKey());
              nextEntry = segments.higherEntry(segment.index());
            } else {
              break;
            }
          }

          descriptor.close();
        }
        // If the segment descriptor wasn't locked, close and delete the descriptor.
        else {
          LOGGER.debug("Deleting unlocked segment: {}-{} ({})", descriptor.id(), descriptor.version(), segmentFile.file().getName());
          descriptor.close();
          descriptor.delete();
        }
      }
    }

    for (Long segmentId : segments.keySet()) {
      Segment segment = segments.get(segmentId);
      Map.Entry<Long, Segment> previousEntry = segments.floorEntry(segmentId - 1);
      if (previousEntry != null) {
        Segment previousSegment = previousEntry.getValue();
        if (previousSegment.index() + previousSegment.length() - 1 < segment.index()) {
          previousSegment.skip(segment.index() - (previousSegment.index() + previousSegment.length()));
        }
      }
    }

    return segments.values();
  }
997716
public List<ElementType> toList() {
        List<ElementType> result = new ArrayList<ElementType>(size());
        for (ElementType e : this) result.add(e);
        return result;
    }
479928
@Pure
	public Iterable<RoadSegment> roadSegments() {
		return new Iterable<RoadSegment>() {
			@Override
			public Iterator<RoadSegment> iterator() {
				return roadSegmentsIterator();
			}
		};
	}
186616
public synchronized List<E> getAll() {
		ArrayList<E> list = new ArrayList<E>();

		for (E element : listElements) {
			if (element != null) {
				list.add(element);
			}
		}

		return list;
	}
1271658
public List<String> asList() {
		return Lists.newLinkedList(Splitter.on(separator.toString()).split(gets()));
	}
1351479
public java.util.List<ReservedInstances> getReservedInstances() {
        if (reservedInstances == null) {
            reservedInstances = new com.amazonaws.internal.SdkInternalList<ReservedInstances>();
        }
        return reservedInstances;
    }
1339994
public List<ByteBuffer> getBufferList() {
        List<ByteBuffer> result = buffers;
        reset();
        for (ByteBuffer buffer : result) {
            buffer.flip();
        }
        return result;
    }
286103
private static List<Element> getLastPartition(List<List<Element>> partitions) {
		if (partitions.isEmpty()) {
			List<Element> newPartition = new LinkedList<Element>();
			partitions.add(newPartition);
			return newPartition;
		} else {
			return partitions.get(partitions.size() - 1);
		}
	}
60629
public java.util.List<String> getRestorableNodeTypes() {
        if (restorableNodeTypes == null) {
            restorableNodeTypes = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return restorableNodeTypes;
    }
42465
public List<T> getList() {
    final ArrayList<T> list = new ArrayList<T>();
    for (final Entry<T, AtomicInteger> e : this.map.entrySet()) {
      for (int i = 0; i < e.getValue().get(); i++) {
        list.add(e.getKey());
      }
    }
    return list;
  }