Java队列实现(Java Queue Implementation)
我是Java新手并尝试使用:
public static ArrayBlockingQueue<String> qu=new ArrayBlockingQueue<>(900); ... qu.enqueue(MyString);
要么
public static Queue<String> qu=new Queue<>(900); ... qu.enqueue(MyString);
队列尖叫,声称它只是一个界面。 ArrayBlockingQueue不接受入队。 我觉得我犯了一些基本错误。 我的问题是:每次使用它时,我是否必须编写自己的Queue来实现接口,或者是否有就绪函数? 如果是的话,我做错了什么? 我的第二个问题是:什么是标准队列大小? 根据我读过的规格,我认为它必须是我可能使用的最大值,但对于小型应用来说,900不是一个很大的空间接受者吗?
I am new to Java and trying to use:
public static ArrayBlockingQueue<String> qu=new ArrayBlockingQueue<>(900); ... qu.enqueue(MyString);
or
public static Queue<String> qu=new Queue<>(900); ... qu.enqueue(MyString);
Queue screams,claiming it's only an interface. ArrayBlockingQueue does not accept enqueue. I feel I'm making some basic mistake. My question is: do I have to write my own Queue implementing the interface every time I use it or is there a ready function? If yes, what am I doing wrong? My second question is: what is a standard queue size? From the specifications I've read I assumed it must be the maximum I may use but isn't 900 a bit big space-taker for a small application?
原文:https://stackoverflow.com/questions/17624191
最满意答案
为了增加aku的优秀答案,对于说英语的人,可以在http://www.hex-rays.com/上找到IDA Pro。
To add to aku's excellent answer, for English speakers, IDA Pro is available at http://www.hex-rays.com/.
相关问答
更多-
VC ++的开头[关闭](Beginnings of VC++ [closed])[2022-07-07]
您需要做的是创建一个基于选择MFC->对话框的应用程序,它将帮助您开始创建对话框和控件,如按钮,单选按钮和复选框。 此外,我建议你阅读这本书。 What you need to do is create a Choose MFC->Dialog based application which will help you to start with creating dialog box and controls like buttons, radio buttons and checkboxes. More ... -
是的,这是合法的 - 包含的访问权限 读,然后 那么增量 写,然后 将递增的值返回给调用者 将是原子的。 只是不要忘记它是32位并且可以溢出。 Yes, that is legal - the access which consists of read, then increment, then write, then return the incremented value to the caller will be atomic. Just don't forget that it's 32 bit a ...
-
这些天使用VC ++?(Uses of VC++ these days?)[2022-10-27]
电脑游戏大部分仍然使用Visual Studio在Windows上用C ++编写。 企业应用程序通常使用c#或java,因为企业有更多的钱购买硬件来弥补游戏需要在大量设备上运行的性能差异,例如PS3,Xbox 360,PS3,Windows,Mac等。对内存有限制。 此外,嵌入式产品,系统实用程序和广泛使用多种低级API的软件仍以C ++编写。 它绝对还有用处。 Computer games are mostly still written in C++ on Windows using Visual St ... -
不,没有要求将.NET与VS 2003(或VS 2008或VS 2010)一起使用。 您可以将VC 6.0项目转移到VS 2003,它仍然是本机项目。 No, there is no requirement to use .NET with VS 2003 (or VS 2008 or VS 2010). You can bring your VC 6.0 project over to VS 2003 and it will still be a native project.
-
GetDC和BitBlt会改变GDI +场景的任何内容吗? Would GetDC & BitBlt change anything for the GDI+ scenario??
-
使用CPPUNIT或GTEST对VC ++ MFC应用程序进行单元测试(Unit testing VC++ MFC application using CPPUNIT or GTEST)[2022-07-14]
我真的不清楚是什么阻止你在没有一些例子的情况下进行测试(也许你可以发明一个简单的例子来证明你的问题)。 如果要访问受保护的类构造函数,可以执行类似这样的操作。 class A { protected: A() {} friend class TestClassA; }; class TestClassA { public: void TestA( void) { A a; // test a } }; It's ... -
为了增加aku的优秀答案,对于说英语的人,可以在http://www.hex-rays.com/上找到IDA Pro。 To add to aku's excellent answer, for English speakers, IDA Pro is available at http://www.hex-rays.com/.
-
.NET VC ++ Redist依赖(.NET VC++ Redist dependency)[2023-09-16]
检查Environment.Is64BitProcess并相应地加载正确的dll 安装正确的vcredist仍然是一个悬而未决的问题 check Environment.Is64BitProcess and load the right dll accordingly the installation of the right vcredist is still an open problem -
地铁风格的应用程序不能有控制台。 您可以在C ++ / CXX应用程序中使用OutputDebugString()在Visual Studio输出窗口中显示调试文本,就像System.Diagnostics.Debug.Write在托管应用程序中一样。 没有很多批准的winapi函数,但OutputDebugString()没问题。 启动MSDN页面就在这里 。 A metro style app cannot have a console. You can use OutputDebugString() ...