在COMPIERE2的MTab类中有这样一段代码:

03-05-07 dragon8943

在COMPIERE2的MTab类中有这样一段代码:

public synchronized void addDataStatusListener(DataStatusListener l)
	{
		Vector v = m_dataStatusListeners == null ? new Vector(2) : (Vector) m_dataStatusListeners.clone();
		if (!v.contains(l))
		{
			v.addElement(l);
			m_dataStatusListeners = v;
		}
}

我的问题是:

The implementation seems to be strange. If I were the author, I would write the following codes:

If(m_dataStatusListeners==null)
m_dataStatusListeners=new Vector(2);
if(!m_dataStatusListeners.contains(l))
v.addElement(l);

Is the second code segment better or does the first code segment have some advanages ?

<p>