All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bestvike.linq.enumerable.AbstractIterator Maven / Gradle / Ivy

The newest version!
package com.bestvike.linq.enumerable;

import com.bestvike.linq.IEnumerable;
import com.bestvike.linq.IEnumerator;

/**
 * 迭代对象,初始 state 为 1
 * 

* Created by 许崇雷 on 2017-07-13. */ public abstract class AbstractIterator extends AbstractEnumerator implements IEnumerable { private final long threadId; public AbstractIterator() { this.threadId = Thread.currentThread().getId(); } @Override public abstract AbstractIterator clone(); @Override public IEnumerator enumerator() { AbstractIterator enumerator = this.state == 0 && this.threadId == Thread.currentThread().getId() ? this : this.clone(); enumerator.state = 1; return enumerator; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy