二元函数
二元 Java 序列迭代器方法通过在对象的序列和输入序列中的对应元素上应用指定的操作来生成相同类型的输出序列。 该操作可以是以下之一:
- SequenceIterator add( SequenceIterator other):返回对象与其它序列中对应元素之和的序列。
- SequenceIterator sub( SequenceIterator other):返回对象与其他序列中对应元素差值的序列。
- SequenceIterator mul( SequenceIterator other):返回对象中对应元素与其他序列相乘的结果序列。
- SequenceIterator div( SequenceIterator other):返回对象中相应元素与其他序列元素相除后的序列。
- SequenceIterator mod( SequenceIterator other):返回对象中对应元素与其他序列中对应元素相除所得余数的序列。
- SequenceIterator max( SequenceIterator other):返回对象与其它序列中对应元素的最大值序列
- SequenceIterator min( SequenceIterator other):Return the sequence of the minimum of the corresponding elements in the object and other sequences
示例
以下是一个演示二进制方法的示例代码片段:
Cursor<Quote> cursor = new Cursor<Quote>(con, Quote.class, "symbol");
for (Quote quote : cursor)
{
...
SequenceIterator high = quote.high.iterator();
SequenceIterator low = quote.low.iterator();
SequenceIterator diff;
...
diff = high.sub(low);
...
}