Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
一般ThreadPoolExecutor接受/访问Queue<Runnable>. 是否有任何方法可以接受/访问自定义队列,即某种对象类型的队列Queue<some class object>?
ThreadPoolExecutor
Queue<Runnable>
Queue<some class object>
CustomObject不,您的参数中没有任何方法。
CustomObject
Runnable是一个接口。
Runnable
您实际上会将您CustomObject的 s 队列作为Runnable.
你只需要确保你CustomObject实现了Runnable接口。