Esempio n. 1
0
        private static sbyte[][] SortedUpdates <Key>(KeyFormat <Key> keys, ConcurrentMap <Key, ChangeEntry> changes)
        {
            Entry[] buffer = new Entry[changes.size()];
            IEnumerator <KeyValuePair <Key, ChangeEntry> > entries = changes.entrySet().GetEnumerator();

            for (int i = 0; i < buffer.Length; i++)
            {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                KeyValuePair <Key, ChangeEntry> next = entries.next();                        // we hold the lock, so this should succeed
                sbyte[] key = new sbyte[keys.KeySize()];
                keys.WriteKey(next.Key, new BigEndianByteArrayBuffer(key));
                buffer[i] = new Entry(key, next.Value.data);
            }
            Arrays.sort(buffer);
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            Debug.Assert(!entries.hasNext(), "We hold the lock, so we should see 'size' entries.");
            sbyte[][] result = new sbyte[buffer.Length * 2][];
            for (int i = 0; i < buffer.Length; i++)
            {
                result[i * 2]     = buffer[i].Key;
                result[i * 2 + 1] = buffer[i].Value;
            }
            return(result);
        }
Esempio n. 2
0
 public virtual Stream <Pair <SocketAddress, ProtocolStack> > InstalledProtocols()
 {
     return(_installedProtocols.entrySet().Select(entry => Pair.of(entry.Key, entry.Value)));
 }