本文整理汇总了Java中com.google.common.collect.Iterables.skip方法的典型用法代码示例。如果您正苦于以下问题:Java Iterables.skip方法的具体用法?Java Iterables.skip怎么用?Java Iterables.skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Iterables
的用法示例。
在下文中一共展示了Iterables.skip方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertToCamelCase
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
/**
* Converts the {@code String str}, to {@code "camelCase"} format.
*
* @param str the {@code String} to format.
* @return the formatted {@code String}.
*/
public static String convertToCamelCase(final String str) {
final String[] parts = str.split("_");
if (parts.length > 0) {
final StringBuilder sb = new StringBuilder();
sb.append(parts[0].toLowerCase());
for (String s : Iterables.skip(Arrays.asList(parts), 1)) {
sb.append(Character.toUpperCase(s.charAt(0)));
if (s.length() > 1) {
sb.append(s.substring(1, s.length()).toLowerCase());
}
}
return sb.toString();
}
return str;
}
示例2: createRightSide
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
public static RightSide createRightSide(List<Element> elements, AbstractModel model, String tag) {
RightSide rightSide = new RightSide();
//miss the first element
for (Element element : Iterables.skip(elements, 1)) {
LanguageElement input = model.createLanguageElement(element);
if (input instanceof NamespacedList) {
rightSide.setNamespacedList((NamespacedList) input);
} else if (input instanceof Values) {
rightSide.setValues((Values) input);
} else {
throw new IllegalStateException("Element " + tag + "'s second or third child must be a values or namespacedList. Found: "
+ element.getTagName());
}
}
return rightSide;
}
示例3: readColumnsFromCsv
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
protected Collection<List<String>> readColumnsFromCsv(final String path) throws IOException {
final List<List<String>> table = new ArrayList<>();
try (final GZIPInputStream trainInputStream = new GZIPInputStream(
getClass().getResourceAsStream(path))) {
for (final String line : Iterables.skip((List<String>) IOUtils.readLines(trainInputStream), 1)) {
final List<String> columns = Splitter.on(getInputCsvSeparator()).splitToList(line);
table.add(columns);
}
}
return table;
}
示例4: initialize
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
/**
* Returns a {@link StackManipulation} that will initialize all non-method parameter local
* variables to their default values. Must be called at the beginning of any method
* implementation.
*/
StackManipulation initialize() {
int numMethodParams = accessors.size() - frameLocalTypes.size();
List<StackManipulation> ops = new ArrayList<>();
for (VariableAccessor var : Iterables.skip(accessors.values(), numMethodParams)) {
ops.add(var.initialize());
}
return new Compound(ops);
}
示例5: getBooking
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private List< Meeting > getBooking( User user, String uri ) throws Exception
{
List< Meeting > bookings = new ArrayList< Meeting >();
HtmlPage page = navigateToPage( user, uri, false );
logger.debug( "Page loaded" );
HtmlTable table = (HtmlTable)page.getByXPath( ".//*[@id='Grid']/table" ).get( 0 );
List< HtmlTableRow > rows = table.getRows();
logger.debug( "Retriving information for " + uri );
for( HtmlTableRow htmlTableRow : Iterables.skip( rows, 1 ) )
{
Meeting meeting = new Meeting();
String asText = htmlTableRow.asText();
String[] split = asText.split( "\t" );
if( split.length <= 1 )
{
return bookings;
}
meeting.setRoom( split[0].trim() );
String bookingDate = split[1].trim();
DateFormat format = new SimpleDateFormat( "MM/dd/yyyy", Locale.ENGLISH );
meeting.setDate( format.parse( bookingDate ) );
String bookingTime = split[2].trim();
String[] timeArray = bookingTime.split( "-" );
meeting.setFromTime( timeArray[0].trim() );
meeting.setToTime( timeArray[1].trim() );
meeting.setReason( split[3].trim() );
if( uri.equals( SHOW_ALL_BOOKINGS ) )
{
meeting.setAttendees( Arrays.asList( split[4].trim() ) );
}
else
{
String meetingId = getMeetingId( htmlTableRow );
meeting.setMeetingId( meetingId );
}
bookings.add( meeting );
}
return bookings;
}