本文整理了Java中cascading.tuple.Tuple.extract()
方法的一些代码示例,展示了Tuple.extract()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tuple.extract()
方法的具体详情如下:
包路径:cascading.tuple.Tuple
类名称:Tuple
方法名:extract
[英]Creates a new Tuple from the given positions, but sets the values in the current tuple to null.
[中]从给定位置创建新元组,但将当前元组中的值设置为null。
代码示例来源:origin: cwensel/cascading
/**
* Method extract creates a new Tuple from the given selector, but sets the values in the current tuple to null.
*
* @param tupleEntry of type TupleEntry
* @param selector of type Fields
* @return Tuple
*/
public static Tuple extract( TupleEntry tupleEntry, Fields selector )
{
return tupleEntry.tuple.extract( tupleEntry.getFields().getPos( selector, tupleEntry.getFields().size() ) );
}
代码示例来源:origin: cwensel/cascading
@Test
public void testExtractSet()
{
Tuple aTuple = tuple.extract( new int[]{0} );
assertEquals( "not equal: aTuple.size()", 1, aTuple.size() );
assertEquals( "not equal: aTuple.get( 0 )", "a", aTuple.getObject( 0 ) );
assertEquals( "not equal: tuple.size()", 5, tuple.size() );
assertEquals( "not equal: tuple.get( 0 )", null, tuple.getObject( 0 ) );
assertEquals( "not equal: tuple.get( 0 )", "b", tuple.getObject( 1 ) );
assertEquals( "not equal: tuple.get( 1 )", "c", tuple.getObject( 2 ) );
tuple.set( new int[]{0}, new Tuple( "A" ) );
assertEquals( "not equal: tuple.size()", 5, tuple.size() );
assertEquals( "not equal: tuple.get( 0 )", "A", tuple.getObject( 0 ) );
assertEquals( "not equal: tuple.get( 0 )", "b", tuple.getObject( 1 ) );
assertEquals( "not equal: tuple.get( 1 )", "c", tuple.getObject( 2 ) );
}
内容来源于网络,如有侵权,请联系作者删除!