Questions tagged [enumeration]

The process of enumerating values, for example from some collection.

Use for enumeration types.

1894 questions
0
votes
1 answer

What values do you return from an ArrayList if the method returns an Enumeration?

So I am currently upgrading some old code which uses Vector into ArrayList and am unsure what to use to replace the old vector segment. public Enumeration enumerateMapping() { return mappingList.elements(); } I need to replace the .elements()…
0
votes
4 answers

Confusion about return value of Enum.GetValues()

I am reading about enumerations in a book, and the following code example was given: namespace FunWithEnums { enum EmpType : byte { Manager = 10, Grunt = 1, Contractor = 100, VicePresident = 9 } …
FrostyStraw
  • 1,628
  • 3
  • 25
  • 34
0
votes
2 answers

C++ enums with attributes like C#

I have the following C# Code which I need to convert into C++ code. I have searched for a bit on how to do C++ Enums with Attributes and can not figure it out. Basically I need a way to represent the following simplified C# Code in C++ which…
EST
  • 407
  • 1
  • 7
  • 10
0
votes
2 answers

Defining an enumeration with default properties, Its effect on performance

Enumeration's default value is integer. However, when we use Enumeration we don't use so many values. So my questions are: enum TYPE : byte{HORIZONTAL , DIAGONAL} //uses 1 byte enum TYPE {HORIZONTAL , DIAGONAL} // int by default. Uses 4…
AliTeo
  • 68
  • 2
  • 11
0
votes
1 answer

Why Scala Enumeration does not work in Apache Zeppelin but it works in maven

Enumeration works as expected when I use it in a maven project(with the same Scala version). object t { object DashStyle extends Enumeration { val Solid,ShortDash = Value } def f(style: DashStyle.Value) = println(style) def main(args:…
Rockie Yang
  • 4,725
  • 31
  • 34
0
votes
0 answers

Mutating value types in enumeration

Say we have struct item { var val = 0 } var items = [item]() items.append(item(val: 0)) items.append(item(val: 1)) items.append(item(val: 2)) This code is obviously not possible since i is a let constant: for i in items { i.val += 10 } What…
cocoapriest
  • 1,869
  • 3
  • 22
  • 36
0
votes
0 answers

Error when calling nextElement of an Enumeration

I'm trying to add files to a .jar file. My problem is that JarOutputStream the old .jar file overwrites. So I created this code: Enumeration enu = game.entries() while(enu.hasMoreElements()){ File f =…
Jorolf
  • 50
  • 8
0
votes
1 answer

Getting Over-Collection was modified; enumeration operation may not execute

I have a string list List mylist.I have a background operation that adds strings to this list. i use another background operation to process the strings in this list foreach (string pfile in mylist) { //dostuff } This results in this…
techno
  • 6,100
  • 16
  • 86
  • 192
0
votes
2 answers

How to stop ´enumerateChildNodesWithName("//*") ´ enumeration?

How do I stop this enumeration? I have the following code and Xcode complaining that I cannot assign a value to let constant. Stopping is probably a simple thing but I'm quite the noobie with Swift, so please bear with…
user594883
  • 1,329
  • 2
  • 17
  • 36
0
votes
2 answers

Java Enums - Number add() and classification method

I am creating an api for a phonebook which has 3 different types of phone-numbers:FAX, HOME, WORK, CELL I want to add a number to a specific type but do not want to classify FAX,HOME,WORK etc. as primitive types as I am considering that I could…
JJunior
  • 2,831
  • 16
  • 56
  • 66
0
votes
1 answer

node.js: Enumerating socket clients

I'm trying to create a server app in node.js, where multiple clients connect, and then one sends data, and that data gets send to another specific client. Which client it gets sent to is determined by a 'user id' that all clients will send after…
Sam
  • 259
  • 2
  • 13
0
votes
4 answers

C# Enumerating Object foreach

I have a simplified version of what I want to do below. I have a class Planet which is used by the class SolarSystem. I want to use a foreach loop to write the orbitTimeInDays for each Planet in SolarSystem. Error CS1579 foreach statement cannot…
FridgeMagnet
  • 105
  • 2
  • 9
0
votes
1 answer

Enumerating all possible sequences when we are given a set of N numbers and range for each of the N numbers

Problem Statement: We are given A set of T numbers S1, S2,....ST An integer called Range This means S1 can take on (2*Range+1) values (S1-Range,S1-Range+1,...S1, S1+1,....S1+Range) Similarly S2, ...ST can take on 2*Range+1 values Problem 1: How…
Smart Home
  • 801
  • 7
  • 26
0
votes
2 answers

Can't we run main method inside enum?

I had seen a video where, main() can be run with in an enum. I am trying to do the same but it's not working. Here is my code public enum EnumMain { ABC, XYZ; public static…
Soumitri Pattnaik
  • 3,246
  • 4
  • 24
  • 42
0
votes
1 answer

Rails 4: Group_by with 2 variables

I have an array that represents the hours of operation for a store and is stored as: schedule = [ [[mon_open, 9], [mon_close, 5]], [[tues_open, 11], [tues_close, 7]], [[wed_open, 9], [wed_close, 5]], …
Jeremy Thomas
  • 6,240
  • 9
  • 47
  • 92
1 2 3
99
100