public static String getSegmentsFile(List<String> files, boolean allowEmpty) {if (files.isEmpty()) {if (allowEmpty) {return null;} else {throw new IllegalStateException("empty list of files not allowed");}}String segmentsFile = files.remove(files.size() - 1);if (!segmentsFile.startsWith(IndexFileNames.SEGMENTS)) {throw new IllegalStateException("last file to copy+sync must be segments_N but got " + segmentsFile+ "; check your Revision implementation!");}return segmentsFile;}

public static string GetSegmentsFile(IList<string> files, bool allowEmpty){if (!files.Any()){if (allowEmpty)return null;throw new InvalidOperationException("empty list of files not allowed");}string segmentsFile = files.Last();files.RemoveAt(files.Count - 1);if (!segmentsFile.StartsWith(IndexFileNames.SEGMENTS, StringComparison.Ordinal) || segmentsFile.Equals(IndexFileNames.SEGMENTS_GEN, StringComparison.Ordinal)){throw new InvalidOperationException(string.Format("last file to copy+sync must be segments_N but got {0}; check your Revision implementation!", segmentsFile));}return segmentsFile;}
