private void MapMachineIds(ManagedCluster cluster) { _machineIds = new InstanceId[cluster.Size()]; HighlyAvailableGraphDatabase master = cluster.Master; master.DependencyResolver.resolveDependency(typeof(Monitors)).addMonitorListener(_monitorListener); _machineIds[0] = cluster.GetServerId(master); IList <HighlyAvailableGraphDatabase> slaves = new List <HighlyAvailableGraphDatabase>(); foreach (HighlyAvailableGraphDatabase hadb in cluster.AllMembers) { if (!hadb.Master) { slaves.Add(hadb); hadb.DependencyResolver.resolveDependency(typeof(Monitors)).removeMonitorListener(_monitorListener); } } slaves.sort(System.Collections.IComparer.comparing(cluster.getServerId)); IEnumerator <HighlyAvailableGraphDatabase> iter = slaves.GetEnumerator(); for (int i = 1; iter.MoveNext(); i++) { _machineIds[i] = cluster.GetServerId(iter.Current); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @ParameterizedTest @MethodSource("validComparableValueGenerators") void compareToMustAlignWithValuesCompareTo(ValueGenerator valueGenerator) internal virtual void CompareToMustAlignWithValuesCompareTo(ValueGenerator valueGenerator) { // Given IList <Value> values = new List <Value>(); IList <GenericKey> states = new List <GenericKey>(); for (int i = 0; i < 10; i++) { Value value = valueGenerator(); values.Add(value); GenericKey state = NewKeyState(); state.WriteValue(value, NEUTRAL); states.Add(state); } // When values.sort(COMPARATOR); //JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter: states.sort(GenericKey::compareValueTo); // Then for (int i = 0; i < values.Count; i++) { assertEquals(values[i], states[i].AsValue(), "sort order was different"); } }
//------------------------------------------------------------------------- // constructs an interpolated nodal curve internal InterpolatedNodalCurve createCurve(LocalDate date, IList <LoadedCurveNode> curveNodes) { // copy and sort IList <LoadedCurveNode> nodes = new List <LoadedCurveNode>(curveNodes); nodes.sort(System.Collections.IComparer.naturalOrder()); // build each node double[] xValues = new double[nodes.Count]; double[] yValues = new double[nodes.Count]; IList <ParameterMetadata> pointsMetadata = new List <ParameterMetadata>(nodes.Count); for (int i = 0; i < nodes.Count; i++) { LoadedCurveNode point = nodes[i]; double yearFraction = dayCount.yearFraction(date, point.Date); xValues[i] = yearFraction; yValues[i] = point.Value; ParameterMetadata pointMetadata = LabelDateParameterMetadata.of(point.Date, point.Label); pointsMetadata.Add(pointMetadata); } // create metadata CurveMetadata curveMetadata = DefaultCurveMetadata.builder().curveName(curveName).xValueType(xValueType).yValueType(yValueType).dayCount(dayCount).parameterMetadata(pointsMetadata).build(); return(InterpolatedNodalCurve.builder().metadata(curveMetadata).xValues(DoubleArray.copyOf(xValues)).yValues(DoubleArray.copyOf(yValues)).interpolator(interpolator).extrapolatorLeft(extrapolatorLeft).extrapolatorRight(extrapolatorRight).build()); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: private static java.util.List<Slave> sortSlaves(final Iterable<Slave> slaves, boolean asc) private static IList <Slave> SortSlaves(IEnumerable <Slave> slaves, bool asc) { List <Slave> slaveList = Iterables.addAll(new List <Slave>(), slaves); slaveList.sort(asc ? _serverIdComparator : _reverseServerIdComparator); return(slaveList); }
protected void gv_onSorting(object sender, GridViewSortEventArgs e) { IQueryable <AdjusterMaster> adjusters = null; adjusters = AdjusterManager.GetAll(clientID); List <AdjusterMaster> objListAdjuster = adjusters.ToList(); bool descending = false; if (ViewState[e.SortExpression] == null) { descending = false; } else { descending = !(bool)ViewState[e.SortExpression]; } ViewState[e.SortExpression] = descending; string sortClause = e.SortExpression + (descending ? " Desc " : " Asc "); gvAdjuster.DataSource = objListAdjuster.sort(sortClause).ToList(); //gvAdjuster.DataSource = adjusters.orderByExtension(e.SortExpression, descending); gvAdjuster.DataBind(); }
internal virtual long Send() { // Sort in reverse, so the elements we want to send first are at the end. _batches.sort(_ticketedBatchComparator); long idleTimeSum = 0; long batchesDone = 0; for (int i = _batches.Count - 1; i >= 0; i--) { TicketedBatch batch = _batches[i]; if (batch.Ticket == _lastSendTicket + 1) { _batches.RemoveAt(i); _lastSendTicket = batch.Ticket; idleTimeSum += _downstream.receive(batch.Ticket, batch.Batch); batchesDone++; } else { break; } } _doneBatches.getAndAdd(batchesDone); return(idleTimeSum); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCompareAllValuesToAllOtherValuesLikeValueComparator() public virtual void ShouldCompareAllValuesToAllOtherValuesLikeValueComparator() { // given IList <Value> values = AsValueObjects(Objects); IList <NumberIndexKey> numberIndexKeys = AsNumberIndexKeys(values); values.sort(Values.COMPARATOR); // when foreach (NumberIndexKey numberKey in numberIndexKeys) { IList <NumberIndexKey> withoutThisOne = new List <NumberIndexKey>(numberIndexKeys); assertTrue(withoutThisOne.Remove(numberKey)); withoutThisOne = unmodifiableList(withoutThisOne); for (int i = 0; i < withoutThisOne.Count; i++) { IList <NumberIndexKey> withThisOneInWrongPlace = new List <NumberIndexKey>(withoutThisOne); withThisOneInWrongPlace.Insert(i, numberKey); withThisOneInWrongPlace.sort(Layout); IList <Value> actual = AsValues(withThisOneInWrongPlace); // then AssertSameOrder(actual, values); } } }
protected void gvInvoiceQ_Sorting(object sender, GridViewSortEventArgs e) { int clientID = SessionHelper.getClientId(); string sortExpression = null; //IQueryable<vw_InvoiceApprovalQueue> invoices = null; List <vw_InvoiceApprovalQueue> invoices = null; //invoices = InvoiceManager.GetInvoiceApprovalQueue(clientID); invoices = getInvoicesFromQueue(); bool descending = false; if (ViewState[e.SortExpression] == null) { descending = false; } else { descending = !(bool)ViewState[e.SortExpression]; } ViewState[e.SortExpression] = descending; sortExpression = e.SortExpression + (descending ? " desc" : " asc"); gvInvoiceQ.DataSource = invoices.sort(sortExpression); gvInvoiceQ.DataBind(); }
public static void Main() { List myList1 = new List(new int[] {2,5,0,6,9,3,7,7,4,8,500,678}); List myList2 = new List(new int[] {2,5,678}); List myList3 = new List(new int[] {2,5,1,1990,0,6,9,3,7,7,4,8,1,1990,0,6,9,3,7,7,4,8,500,678}); myList1.sort (); myList2.sort (); myList3.sort (); }
private static IList <BlockEntry <MutableLong, MutableLong> > SortAll(IEnumerable <IList <BlockEntry <MutableLong, MutableLong> > > data) { IList <BlockEntry <MutableLong, MutableLong> > result = new List <BlockEntry <MutableLong, MutableLong> >(); foreach (IList <BlockEntry <MutableLong, MutableLong> > list in data) { ((IList <BlockEntry <MutableLong, MutableLong> >)result).AddRange(list); } result.sort(_blockEntryComparator); return(result); }
public override char GetLetterGrade(double averageGrade) { List <Student> sorted = new List <Student>(Students); sorted = sorted.sort(); if (Student.length < 5) { throw new InvalidOperationException("Ranked-grading requires a minimum of 5 students to work"); } return('F'); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSplitUpRelationshipTypesInBatches() public virtual void ShouldSplitUpRelationshipTypesInBatches() { // GIVEN int denseNodeThreshold = 5; int numberOfNodes = 100; int numberOfTypes = 10; NodeRelationshipCache cache = new NodeRelationshipCache(NumberArrayFactory.HEAP, denseNodeThreshold); cache.NodeCount = numberOfNodes + 1; Direction[] directions = Direction.values(); for (int i = 0; i < numberOfNodes; i++) { int count = Random.Next(1, denseNodeThreshold * 2); cache.setCount(i, count, Random.Next(numberOfTypes), Random.among(directions)); } cache.CountingCompleted(); IList <RelationshipTypeCount> types = new List <RelationshipTypeCount>(); int numberOfRelationships = 0; for (int i = 0; i < numberOfTypes; i++) { int count = Random.Next(1, 100); types.Add(new RelationshipTypeCount(i, count)); numberOfRelationships += count; } types.sort((t1, t2) => Long.compare(t2.Count, t1.Count)); DataStatistics typeDistribution = new DataStatistics(0, 0, types.ToArray()); { // WHEN enough memory for all types long memory = cache.CalculateMaxMemoryUsage(numberOfRelationships) * numberOfTypes; int upToType = ImportLogic.NextSetOfTypesThatFitInMemory(typeDistribution, 0, memory, cache.NumberOfDenseNodes); // THEN assertEquals(types.Count, upToType); } { // and WHEN less than enough memory for all types long memory = cache.CalculateMaxMemoryUsage(numberOfRelationships) * numberOfTypes / 3; int startingFromType = 0; int rounds = 0; while (startingFromType < types.Count) { rounds++; startingFromType = ImportLogic.NextSetOfTypesThatFitInMemory(typeDistribution, startingFromType, memory, cache.NumberOfDenseNodes); } assertEquals(types.Count, startingFromType); assertThat(rounds, greaterThan(1)); } }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: private java.util.List<org.neo4j.graphdb.PropertyContainer> sortedEntities(java.util.LinkedList<org.neo4j.helpers.collection.Pair<org.neo4j.graphdb.PropertyContainer, long>> timestamps, final boolean reversed) private IList <PropertyContainer> SortedEntities(LinkedList <Pair <PropertyContainer, long> > timestamps, bool reversed) { IList <Pair <PropertyContainer, long> > sorted = new List <Pair <PropertyContainer, long> >(timestamps); sorted.sort((o1, o2) => !reversed ? o1.other().compareTo(o2.other()) : o2.other().compareTo(o1.other())); IList <PropertyContainer> result = new List <PropertyContainer>(); foreach (Pair <PropertyContainer, long> timestamp in sorted) { result.Add(timestamp.First()); } return(result); }
public string formatForDisplay(object @object) { ISet <string> validTokens = ValuePathEvaluator.tokens(@object); if (validTokens.Count == 0) { return(Messages.format("<{}> - drilling into this type is not supported", @object.GetType().Name)); } else { IList <string> orderedTokens = new List <string>(validTokens); orderedTokens.sort(null); return(Messages.format("<{}> - drill down using a field: {}", @object.GetType().Name, orderedTokens)); } }
public static List <LeadView> GetLeads(Expression <Func <Leads, bool> > predicate, string sortExpression, bool descending) { string sortClause = null; List <LeadView> listView = GetLeads(predicate); if (listView != null) { sortClause = sortExpression + (descending ? " Desc " : " Asc "); listView = listView.sort(sortClause).ToList(); } return(listView); }
public void listExample() { List<int> myList = new List<int>(); myList.add(47); int i = myList.get(0); myList.set(0, 1); myList.clear(); List<SelectOption> options = new List<SelectOption>(); options.add(new SelectOption("A","United States")); options.add(new SelectOption("C","Canada")); options.add(new SelectOption("A","Mexico")); System.debug("Before sorting: "+ options); options.sort(); System.debug("After sorting: "+ options); }
static void SortDoubleList() { DoubleLinkedList list1 = new DoubleLinkedList(); DoubleLinkedList list2 = new DoubleLinkedList(); list1.insert(3); list1.insert(100); list1.insert(9); list1.insert(19); list2.insert(300); list2.insert(111); list1.head = List.sort(list1.head, list2.head); list1.print(); }
public virtual void Commit() { if (_changeCounter.value() == 0) { return; } IList <DirectRecordProxy> directRecordProxies = new List <DirectRecordProxy>(_batch.Values); directRecordProxies.sort((o1, o2) => Long.compare(-o1.Key, o2.Key)); foreach (DirectRecordProxy proxy in directRecordProxies) { proxy.Store(); } _changeCounter.clear(); _batch.Clear(); }
/// <summary> /// __dir__(self) -> Returns the list of members defined on a foreign IDynamicMetaObjectProvider. /// </summary> public static List DynamicDir(CodeContext /*!*/ context, IDynamicMetaObjectProvider self) { List res = new List(self.GetMetaObject(Expression.Parameter(typeof(object))).GetDynamicMemberNames()); // add in the non-dynamic members from the dynamic objects base class. Type t = self.GetType(); while (typeof(IDynamicMetaObjectProvider).IsAssignableFrom(t)) { t = t.GetBaseType(); } res.extend(DynamicHelpers.GetPythonTypeFromType(t).GetMemberNames(context)); res.sort(context); return(res); }
private IList <BlockEntry <MutableLong, MutableLong> > SomeBlockEntries(ISet <MutableLong> uniqueKeys) { IList <BlockEntry <MutableLong, MutableLong> > entries = new List <BlockEntry <MutableLong, MutableLong> >(); int size = Rnd.Next(10); for (int i = 0; i < size; i++) { MutableLong key; do { key = _layout.key(Rnd.nextLong(10_000)); } while (!uniqueKeys.Add(key)); MutableLong value = _layout.value(Rnd.nextLong(10_000)); entries.Add(new BlockEntry <>(key, value)); } entries.sort(_blockEntryComparator); return(entries); }
static void SortSingleList() { SingleLinkedList list1 = new SingleLinkedList(); SingleLinkedList list2 = new SingleLinkedList(); list1.insert(8); list1.insert(10); list1.insert(12); list1.insert(17); list2.insert(1); list2.insert(2); list1.head = List.sort(list1.head, list2.head); // list1.head = List.sort(list1.head,list2.head); list1.print(); }
void SetupScroll() { //if (Managers.Game.PlayerPrefab) //PlayerTransform = Managers.Game.PlayerPrefab.transform; List <ScrollLayer> scrollList = new List <ScrollLayer>(FindObjectsOfType(typeof(ScrollLayer)) as ScrollLayer[]); //if ( scrollList.Count == 0 ) return; foreach (ScrollLayer scroll in scrollList) { scroll.SetWeight(Vector3.Distance(Managers.Display.camTransform.position, scroll.transform.position)); } #if UNITY_FLASH scrollList.sort(ScrollLayer.Comparision); #else scrollList.Sort(); #endif ScrollLayers = scrollList.ToArray(); }
public List <LeadView> Search(Expression <Func <vw_Lead_Search, bool> > predicate, string sortExpression, bool descending) { string sortClause = null; List <LeadView> listView = null; listView = Search(predicate); if (listView != null) { sortClause = sortExpression + (descending ? " Desc " : " Asc "); listView = listView.sort(sortClause).ToList(); } return(listView); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public GrafoM<N> KruskalGrafoMatriz(IGrafo<N> grafo) throws Excepciones.ExcepcionAristaImposible, Excepciones.ExcepcionNodoNoEncontrado public virtual GrafoM<N> KruskalGrafoMatriz(IGrafo<N> grafo) { GrafoM<N> graph = null; if (grafo.esDirigido()) { graph = new GrafoM<N>(true, true); } else { graph = new GrafoM<N>(false, true); } List<Arista<N>> aristas = grafo.generarAristas(); aristas.sort(null); List<N> nodos = grafo.darValorNodos(); for (int i = 0; i < nodos.Count; i++) { graph.agregarNodo(nodos[i]); } List<Conjunto<N>> conjuntos = new List<Conjunto<N>>(); for (int i = 0; i < nodos.Count; i++) { conjuntos.Add(new Conjunto<N>(nodos[i])); } for (int i = 0; i < aristas.Count && conjuntos.Count > 1; i++) { int n = conjuntos.Count; Arista<N> arista = aristas[i]; N nodo1 = arista.NodoInicial.Valor; N nodo2 = arista.NodoFinal.Valor; for (int j = 0; j < conjuntos.Count; j++) { if (conjuntos[j].existeNodoEnElConjunto(nodo1) && !conjuntos[j].existeNodoEnElConjunto(nodo2)) {
static void Main(string[] args) { var fibonacciNumbers = new List<int> {1, 1}; var previous fibonacciNumbers[fibonacciNumbers.Count-1]; var previous2 fibonacciNumbers[fibonacciNumbers.Count-2]; fibonacciNumbers.Add(previous + previous2); foreach(var item in fibonacciNumbers); Console.WriteLine(item); var names = new List<string> {"Godwin", "Ana", "Felipe" }; foreach ( var name in names) Console.WriteLine(); names.Add("Maria"); names.Add("Bill"); names.Add("judith"); names.Remove("Ana"); foreach (var name in names) { Console.WriteLine($"my name is {names[0]}"); Console.WriteLine($"i have added {names [2]} and {names [3]}"); Console.WriteLine($"Hello {name.ToUpper()}"); Console.WriteLine($"The list has {names.Count} people in it"); var indexof = names.IndexOf("Felipe"); if(index == -1) { Console.WriteLine($" The name{names[index]} is at index{index}"); var notFound = names.IndexOf("notFound"); Console.WriteLine($"when an item is not found, Index returns {notFound}"); names.sort(); foreach ( var name in names) { Console.WriteLine($"hello {name.ToUpper()}!"); } } } }
private void AssertThatItWorksOneWay(IList <NodeWithPropertyValues> listA, IList <NodeWithPropertyValues> listB) { SortedMergeJoin sortedMergeJoin = new SortedMergeJoin(); sortedMergeJoin.Initialize(IndexOrder); IComparer <NodeWithPropertyValues> comparator = IndexOrder == IndexOrder.ASCENDING ? (a, b) => ValueTuple.COMPARATOR.Compare(ValueTuple.of(a.Values), ValueTuple.of(b.Values)) : (a, b) => ValueTuple.COMPARATOR.Compare(ValueTuple.of(b.Values), ValueTuple.of(a.Values)); listA.sort(comparator); listB.sort(comparator); IList <NodeWithPropertyValues> result = Process(sortedMergeJoin, listA.GetEnumerator(), listB.GetEnumerator()); IList <NodeWithPropertyValues> expected = new List <NodeWithPropertyValues>(); ((IList <NodeWithPropertyValues>)expected).AddRange(listA); ((IList <NodeWithPropertyValues>)expected).AddRange(listB); expected.sort(comparator); assertThat(result, equalTo(expected)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldCombineAllParts() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldCombineAllParts() { // given SimpleLongLayout layout = new SimpleLongLayout(0, "", true, 1, 2, 3); IList <RawCursor <Hit <MutableLong, MutableLong>, IOException> > parts = new List <RawCursor <Hit <MutableLong, MutableLong>, IOException> >(); int partCount = Random.Next(1, 20); IList <Hit <MutableLong, MutableLong> > expectedAllData = new List <Hit <MutableLong, MutableLong> >(); int maxKey = Random.Next(100, 10_000); for (int i = 0; i < partCount; i++) { int dataSize = Random.Next(0, 100); IList <Hit <MutableLong, MutableLong> > partData = new List <Hit <MutableLong, MutableLong> >(dataSize); for (int j = 0; j < dataSize; j++) { long key = Random.nextLong(maxKey); partData.Add(new SimpleHit <>(new MutableLong(key), new MutableLong(key * 2))); } partData.sort(_hitComparator); parts.Add(new SimpleSeeker(partData)); ((IList <Hit <MutableLong, MutableLong> >)expectedAllData).AddRange(partData); } expectedAllData.sort(_hitComparator); // when CombinedPartSeeker <MutableLong, MutableLong> combinedSeeker = new CombinedPartSeeker <MutableLong, MutableLong>(layout, parts); // then foreach (Hit <MutableLong, MutableLong> expectedHit in expectedAllData) { assertTrue(combinedSeeker.Next()); Hit <MutableLong, MutableLong> actualHit = combinedSeeker.Get(); assertEquals(expectedHit.Key().longValue(), actualHit.Key().longValue()); assertEquals(expectedHit.Value().longValue(), actualHit.Value().longValue()); } assertFalse(combinedSeeker.Next()); // And just ensure it will return false again after that assertFalse(combinedSeeker.Next()); }
protected void gvCarriers_Sorting(object sender, GridViewSortEventArgs e) { List <CarrierView> carriers = CarrierManager.GetAll(clientID); bool descending = false; if (ViewState[e.SortExpression] == null) { descending = false; } else { descending = !(bool)ViewState[e.SortExpression]; } ViewState[e.SortExpression] = descending; string sortClause = e.SortExpression + (descending ? " Desc " : " Asc "); gvCarriers.DataSource = carriers.sort(sortClause).ToList(); gvCarriers.DataBind(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void compareGenericKeyState() internal virtual void CompareGenericKeyState() { IList <Value> allValues = Arrays.asList(Values.of("string1"), Values.of(42), Values.of(true), Values.of(new char[] { 'a', 'z' }), Values.of(new string[] { "arrayString1", "arraysString2" }), Values.of(new sbyte[] { ( sbyte )1, ( sbyte )12 }), Values.of(new short[] { 314, 1337 }), Values.of(new int[] { 3140, 13370 }), Values.of(new long[] { 31400, 133700 }), Values.of(new bool[] { false, true }), DateValue.epochDate(2), LocalTimeValue.localTime(100000), TimeValue.time(43_200_000_000_000L, ZoneOffset.UTC), TimeValue.time(43_201_000_000_000L, ZoneOffset.UTC), TimeValue.time(43_200_000_000_000L, ZoneOffset.of("+01:00")), TimeValue.time(46_800_000_000_000L, ZoneOffset.UTC), LocalDateTimeValue.localDateTime(2018, 3, 1, 13, 50, 42, 1337), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "UTC"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "Europe/Stockholm"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2015, 3, 25, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 4, 25, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 26, 12, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 13, 45, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 12, 46, 13, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 14, 7474, "+05:00"), DateTimeValue.datetime(2014, 3, 25, 12, 45, 13, 7475, "+05:00"), DateTimeValue.datetime(2038, 1, 18, 9, 14, 7, 0, "-18:00"), DateTimeValue.datetime(10000, 100, ZoneOffset.ofTotalSeconds(3)), DateTimeValue.datetime(10000, 101, ZoneOffset.ofTotalSeconds(-3)), DurationValue.duration(10, 20, 30, 40), DurationValue.duration(11, 20, 30, 40), DurationValue.duration(10, 21, 30, 40), DurationValue.duration(10, 20, 31, 40), DurationValue.duration(10, 20, 30, 41), Values.dateTimeArray(new ZonedDateTime[] { ZonedDateTime.of(2018, 10, 9, 8, 7, 6, 5, ZoneId.of("UTC")), ZonedDateTime.of(2017, 9, 8, 7, 6, 5, 4, ZoneId.of("UTC")) }), Values.localDateTimeArray(new DateTime[] { new DateTime(2018, 10, 9, 8, 7, 6, 5), new DateTime(2018, 10, 9, 8, 7, 6, 5) }), Values.timeArray(new OffsetTime[] { OffsetTime.of(20, 8, 7, 6, ZoneOffset.UTC), OffsetTime.of(20, 8, 7, 6, ZoneOffset.UTC) }), Values.dateArray(new LocalDate[] { LocalDate.of(2018, 12, 28), LocalDate.of(2018, 12, 28) }), Values.localTimeArray(new LocalTime[] { LocalTime.of(9, 28), LocalTime.of(9, 28) }), Values.durationArray(new DurationValue[] { DurationValue.duration(12, 10, 10, 10), DurationValue.duration(12, 10, 10, 10) })); allValues.sort(Values.COMPARATOR); IList <GenericKey> states = new List <GenericKey>(); foreach (Value value in allValues) { GenericKey state = new GenericKey(null); state.WriteValue(value, NativeIndexKey.Inclusion.Neutral); states.Add(state); } Collections.shuffle(states); //JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter: states.sort(GenericKey::compareValueTo); //JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter: IList <Value> sortedStatesAsValues = states.Select(GenericKey::asValue).ToList(); assertEquals(allValues, sortedStatesAsValues); }
public virtual string Usage() { StringBuilder sb = new StringBuilder(); if (_namedArgs.Count > 0) { //JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter: //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: sb.Append(_namedArgs.Values.Select(NamedArgument::usage).collect(Collectors.joining(" "))); } if (_positionalArgs.Count > 0) { sb.Append(" "); //JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter: _positionalArgs.sort(System.Collections.IComparer.comparingInt(PositionalArgument::position)); //JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter: //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: sb.Append(_positionalArgs.Select(PositionalArgument::usage).collect(Collectors.joining(" "))); } return(sb.ToString().Trim()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGetAllSinglePropertyValues() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldGetAllSinglePropertyValues() { int label = Token.nodeLabel("Node"); int prop = Token.propertyKey("prop"); IndexReference index = SchemaRead.index(label, prop); using (NodeValueIndexCursor node = Cursors.allocateNodeValueIndexCursor()) { Read.nodeIndexScan(index, node, IndexOrder.NONE, true); IList <Value> values = new List <Value>(); while (node.Next()) { values.Add(node.PropertyValue(0)); } values.sort(Values.COMPARATOR); for (int i = 0; i < _singlePropValues.Count; i++) { assertEquals(_singlePropValues[i], values[i]); } } }
internal static int CompareToWorker(CodeContext/*!*/ context, IDictionary<object, object> left, List ritems) { List litems = DictionaryOps.items(left); litems.sort(context); ritems.sort(context); return litems.CompareToWorker(ritems); }