12 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for Pyler
Member Avatar for Pyler

Suppose I have the following generic classes; Queue<T> KellysCoffee CheckOut and the following generic interfaces QueueInterface OrderLineInterface Suppose I want `KellysCoffee` to extend Queue class and implement `OrderLineInterface` This is how I've done it private class KellyCoffee<Order extends Queue<Order>> implements OrderLineInterface{} Now when I try to implement `CheckOut` public class …

Member Avatar for Pyler
0
294
Member Avatar for Pyler

would you just do @Override public boolean contains(T param){ return hashTable[function(param)]!=null; }

Member Avatar for JamesCherrill
0
214
Member Avatar for rahul.ch

import java.util.*; public class GenericDemo4 { public static void main(String r[]) { Set s1 = new HashSet(); s1.add(0); s1.add("1"); dostuff(s1); } static void dostuff(Set<Number> s) { do2(s); Iterator i = s.iterator(); while(i.hasNext()) System.out.println(i.next() + " "); Object [] oa = s.toArray(); for(int x = 0; x<oa.length; x++) System.out.println(oa[x] + " …

Member Avatar for rahul.ch
0
299
Member Avatar for rahul.ch

import java.util.*; class SampleA { } class SampleB extends SampleA{ } class SampleC extends SampleA{ } class VectorDemo { public static void main(String r[]) { Vector<SampleA> v = new Vector<SampleA>(); v.add(new SampleB()); v.add(new SampleC()); SampleC rect = v.get(2); } } The output says "Incompatible types. Found SampleA, required SampleC. SampleC …

Member Avatar for rahul.ch
0
225
Member Avatar for sciwizeh

Hello all, been a while since I've asked a question. I'm working on a project just to practice and for fun and I've run into a snag. I'm working on a painting type program and I'm trying to get a generic Buffer class for the images so I can use …

Member Avatar for sciwizeh
0
2K
Member Avatar for ventura1

Related to: C#; Windows form, Storing Multiple Instances of a User Control: Hi: I’ve created an app with a user control that accepts parameters. When a user clicks a button I need to store the current view of the control and bring into focus on demand. Several instances of the …

Member Avatar for ventura1
0
256
Member Avatar for six_sic6

Hellow. I have 3 variables 1. string query; 2. public static OracleCommand oracmd; 3. public static OracleDataReader reader; I have used these variables in a function [CODE=C#] . . . public void PreviousValue() { query = " select * from....... "; oracmd = new OracleCommand(); .... .... reader = oracmd.ExecuteReader(); …

Member Avatar for six_sic6
0
188
Member Avatar for VIeditorlover

I have a problem with this construction, can not find how to rewrite it properly. [CODE] private SqlParameter op <T> (T? t, string name) { SqlParameter sp = new SqlParameter(); sp.IsNullable = true; sp.ParameterName = name; sp.Value = t.HasValue ? t.Value : Convert.DBNull; return sp; } [/CODE]

Member Avatar for gusano79
0
215
Member Avatar for daudiam

I can understand that the subtype covariance relation should not hold for parameterized types, but why should it hold for arrays ? One of the books (Khalid Moghul) said [QUOTE]This relation holds for arrays because the element type is available at runtime[/QUOTE] How does the element type being available at …

Member Avatar for daudiam
0
169
Member Avatar for JDCyrus

Hello. It's been a while since I was on here. I'm writing a Java class with a generic type parameter. Among other things, it maintains an internal ArrayList of the same generic type as itself. In a perfect world, the code would go like this: [CODE=Java]import java.util.ArrayList; public class MyGenericClass<T> …

Member Avatar for JDCyrus
0
181
Member Avatar for kirtan_thakkar

I am getting the message when i start the computer that Generic Host Process for Win32 Services Error. I have seen the advanced options/details of the message and it is as under: szAppName : svchost.exe szAppVer : 5.1.2600.2055 szModName : wiaservc.dll szModVer : 5.1.2600.2055 offset : 00017f81 Please help me …

Member Avatar for kirtan_thakkar
0
125

The End.