queue - How to make a shallow copy of a list Java -


i've made class revolved around implementing queues using linked list. implementation works fine. however, have write constructor passed queue, , has make duplicate of original queue. duplicate, mean elements in each queue same, actual nodes not. how go doing this?

p.s. may not use collections class means no clone() method.

from described algorithm achieve be:

  1. write constructor accepts queue example
  2. access head of underlying linked list
  3. traverse list, using elements populate queue, creating new nodes hold same values

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -